Here's a basic implementation of the social network frontend using HTML, CSS, and JavaScript. I'll provide the code for each file:
index.html
<!DOCTYPE html>
<html lang="pt-PT">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CleanConnect - Rede Social para Limpeza</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- Navbar -->
<nav class="navbar">
<div class="logo-container">
<div id="logo" style="width: 80px; height: 80px; background-color: #4CAF50;"></div>
</div>
<div class="nav-links">
<a href="#home" class="nav-link">Início</a>
<a href="#candidates" class="nav-link">Candidatos</a>
<a href="#hiring" class="nav-link">Contratação</a>
</div>
<div class="account-section">
<button class="account-btn" onclick="toggleDropdown()">
<img src="user-icon.png" alt="Conta" class="account-icon">
</button>
<div id="account-dropdown" class="dropdown-menu">
<a href="#settings">Configurações</a>
<a href="#logout">Sair</a>
</div>
</div>
</nav>
<!-- Main Content -->
<main>
<!-- Search Bar -->
<div class="search-container">
<form action="#" class="search-form">
<input type="text" class="search-input" placeholder="Procurar serviços ou profissionais...">
<button type="submit" class="search-btn">Pesquisar</button>
</form>
</div>
<!-- Action Buttons -->
<div class="action-buttons">
<button class="primary-btn">Contratar Agora</button>
<button class="secondary-btn">Registar como Candidato</button>
</div>
</main>
<script src="script.js"></script>
</body>
</html>
styles.css
/* Global Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
/* Navbar Styles */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 5%;
background-color: #333;
color: white;
}
.navbar .logo-container {
width: 80px;
height: 80px;
margin-right: 2rem;
}
.navbar .nav-links {
display: flex;
gap: 2rem;
list-style: none;
}
.nav-link {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
}
.nav-link:hover {
background-color: #555;
}
.account-section {
position: relative;
}
.account-btn {
background: none;
border: none;
cursor: pointer;
}
.account-icon {
width: 35px;
height: 35px;
border-radius: 50%;
}
.dropdown-menu {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 120px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
right: 0;
}
.dropdown-menu a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-menu a:hover {
background-color: #f1f1f1;
}
/* Main Content Styles */
.search-container {
display: flex;
justify-content: center;
margin-top: 5rem;
}
.search-form {
display: flex;
align-items: center;
width: 60%;
max-width: 600px;
background-color: #f1f1f1;
padding: 1rem;
border-radius: 25px;
}
.search-input {
flex: 1;
padding: 1rem;
border: none;
outline: none;
font-size: 1rem;
}
.search-btn {
padding: 1rem 2rem;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.action-buttons {
display: flex;
justify-content: center;
margin: 3rem 0;
gap: 2rem;
}
.primary-btn {
padding: 1rem 3rem;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.secondary-btn {
padding: 1rem 3rem;
background-color: #f1f1f1;
color: #333;
border: 1px solid #ccc;
border-radius: 5px;
cursor: pointer;
}
.primary-btn:hover,
.secondary-btn:hover {
opacity: 0.9;
}
script.js
function toggleDropdown() {
const dropdown = document.getElementById('account-dropdown');
if (dropdown.style.display === 'block') {
dropdown.style.display = 'none';
} else {
dropdown.style.display = 'block';
}
}
// Close dropdown when clicking outside
window.onclick = function(event) {
if (!event.target.matches('.account-btn')) {
const dropdown = document.getElementById('account-dropdown');
if (dropdown.style.display === 'block') {
dropdown.style.display = 'none';
}
}
}
Implementation Notes:
-
Logo Placement:
-
Language:
- All text is in Portuguese (Portugal). You can translate any remaining text as needed.
-
Responsive Design:
- The layout is basic and works well on desktop. For mobile optimization, add media queries in
styles.css.
-
Functionality:
- The account dropdown works with:
- Clicking the account icon
- Closing when clicking outside
-
Buttons:
- Primary button (green) for hiring actions
- Secondary button (light gray) for candidate registration
-
Search Bar:
- Centered on the page
- Responsive width (60% of container, max 600px)
To use this code:
- Replace the logo placeholder with your actual image
- Add your own CSS styling for the account icon
- Implement backend functionality for the buttons and search
- Add more pages for the links (Candidates, Hiring, etc.)
Let me know if you need help with any specific part or want to add more features!