Skip to content

Commit 03acf19

Browse files
committed
Fix navbar
1 parent a52eaf9 commit 03acf19

2 files changed

Lines changed: 70 additions & 56 deletions

File tree

src/TopBar.css

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
transition: background-color 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease;
2222
}
2323

24-
.top-bar.solid {
24+
/* .top-bar.solid {
2525
background-color: rgb(230, 230, 230);
2626
box-shadow: none;
2727
border-radius: 0;
@@ -30,7 +30,7 @@
3030
right: 0;
3131
margin: 0;
3232
width: 100%;
33-
}
33+
} */
3434

3535
/* --- Logo y Contenedores --- */
3636
.logo {
@@ -63,6 +63,7 @@
6363
transition: background-color 0.3s ease, color 0.3s ease, border-radius 0.3s ease;
6464
height: auto;
6565
border-radius: 8px;
66+
margin-left: 5px;
6667
}
6768

6869
.top-bar-item:not(.btn-highlight):hover {
@@ -76,6 +77,7 @@
7677
padding: 1em 2em;
7778
border-radius: 8px;
7879
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
80+
margin-left: 30px;
7981
}
8082

8183
.top-bar-item.btn-highlight:hover {
@@ -197,75 +199,91 @@
197199
/* --- Media Query para Móviles --- */
198200
@media (max-width: 768px) {
199201
.top-bar {
200-
top: 0;
201-
left: 0;
202-
right: 0;
203-
width: 100%;
204-
margin: 0;
205-
border-radius: 0;
206-
background-color: rgb(230, 230, 230);
207-
backdrop-filter: none;
208-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
202+
background-color: transparent !important;
203+
backdrop-filter: none !important;
204+
box-shadow: none !important;
205+
display: flex;
206+
flex-direction: column;
207+
align-items: flex-end;
208+
height: auto;
209+
top: 1em;
210+
left: 1em;
211+
right: 1em;
209212
}
210-
213+
211214
.top-bar-left {
215+
width: 100%;
212216
display: flex;
213217
justify-content: space-between;
214-
align-items: center;
215-
width: 100%;
218+
align-items: center;
219+
background-color: rgb(230, 230, 230);
220+
border-radius: 12px;
221+
height: 77px;
222+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
216223
}
217224

218225
.top-bar-right {
226+
display: none;
219227
flex-direction: column;
220-
width: 100%;
221-
padding-right: 0;
228+
/* Aligns the dropdown container itself to the right */
229+
align-items: stretch;
230+
/* This width ensures the rectangle isn't too skinny but fits the text */
231+
min-width: 160px;
232+
width: auto;
233+
margin-top: 10px;
234+
padding: 8px;
235+
background-color: rgb(230, 230, 230);
236+
border-radius: 12px;
237+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
222238
}
223-
239+
240+
.top-bar.solid .top-bar-right {
241+
display: flex;
242+
}
243+
224244
.top-bar-item {
225245
display: none;
226-
width: 100%;
227-
padding: 1.2em 0;
228-
text-align: center;
229-
border: none;
230-
background-color: rgb(240, 240, 240); /* Fondo un poco más claro para ítems en móvil */
231-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
232-
color: #242424 !important;
233-
border-radius: 0;
246+
width: 100%; /* Take up the full width of the dropdown */
247+
padding: 12px 0; /* Vertical padding only */
248+
text-align: center; /* THE FIX: Centers the text */
249+
margin-left: 0;
250+
font-size: 0.9em;
251+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
234252
}
235253

236-
/* El botón lila también se muestra como un ítem de menú en móvil */
237-
.top-bar-item.btn-highlight {
238-
background-color: #8a63d2;
239-
color: rgb(255, 255, 255) !important;
240-
border-bottom: none; /* No necesita borde inferior si es el último */
241-
}
242-
243-
.top-bar-item:not(.btn-highlight):hover {
244-
background-color: rgba(0, 0, 0, 0.05);
254+
.top-bar.solid .top-bar-item {
255+
display: block;
245256
}
246257

247-
/* Eliminar borde inferior del último ítem si no es el botón lila */
248-
.top-bar-right .top-bar-item:not(.btn-highlight):last-child {
249-
border-bottom: none;
258+
.top-bar-item.btn-highlight {
259+
background-color: #8a63d2;
260+
color: rgb(255, 255, 255) !important;
261+
padding: 1em 2em;
262+
border-radius: 8px;
263+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
264+
margin-left: 0px;
265+
}
266+
267+
/* Remove the bottom border for the last item and the highlight button */
268+
.top-bar-item:nth-last-child(2),
269+
.top-bar-item.btn-highlight {
270+
border-bottom: none;
250271
}
251272

252-
/* Mostrar los ítems cuando el menú está abierto */
253-
.top-bar-item.visible {
254-
display: block;
273+
.top-bar-item.btn-highlight {
274+
margin-top: 8px;
275+
background-color: #8a63d2;
276+
color: white !important;
277+
border-radius: 8px;
278+
padding: 12px 20px;
255279
}
256280

257281
.mobile-menu {
258282
display: flex;
259-
background-color: transparent;
260-
}
261-
262-
.logo {
263-
padding-left: 1.5em;
264-
padding-right: 0;
265283
}
266284

267-
/* Ocultar selector de idioma y botón circular en móvil si no se usan */
268-
.language-selector, .circular-icon-btn {
269-
display: none;
285+
.logo {
286+
max-height: 50px;
287+
padding-left: 1em;
270288
}
271289
}

src/TopBar.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
44
import aedLogo from '/aed.webp';
55
import './TopBar.css';
66

7-
// Componente para el botón de menú hamburguesa (sin cambios)
87
const MenuButton = ({ menuOpen, setMenuOpen }) => (
98
<div className={`mobile-menu${menuOpen ? ' menu-open' : ''}`} onClick={() => setMenuOpen((prev) => !prev)}>
109
<div className='bar' />
@@ -17,7 +16,6 @@ MenuButton.propTypes = {
1716
setMenuOpen: PropTypes.func.isRequired,
1817
};
1918

20-
// Componente para los ítems de la barra superior
2119
const TopBarItem = ({ id, children, menuOpen, setMenuOpen, isHighlight = false }) => (
2220
<a
2321
onClick={() => setMenuOpen(false)}
@@ -32,13 +30,12 @@ TopBarItem.propTypes = {
3230
children: PropTypes.string.isRequired,
3331
menuOpen: PropTypes.bool.isRequired,
3432
setMenuOpen: PropTypes.func.isRequired,
35-
isHighlight: PropTypes.bool, // Nueva prop para el botón resaltado
33+
isHighlight: PropTypes.bool,
3634
};
3735

38-
// Componente de la barra superior principal
3936
function TopBar() {
4037
const [menuOpen, setMenuOpen] = useState(false);
41-
const [selectedLanguage, setSelectedLanguage] = useState('Català'); // Estado para el idioma
38+
const [selectedLanguage, setSelectedLanguage] = useState('Català');
4239

4340
return (
4441
<div className={`top-bar ${menuOpen ? ' solid' : ''}`}>
@@ -50,12 +47,11 @@ function TopBar() {
5047

5148

5249

53-
{/* Ítems de navegación normales */}
5450
<TopBarItem id='' menuOpen={menuOpen} setMenuOpen={setMenuOpen}>Qui som?</TopBarItem>
5551
<TopBarItem id='objectius' menuOpen={menuOpen} setMenuOpen={setMenuOpen}>Objectius</TopBarItem>
5652
<TopBarItem id='projectes' menuOpen={menuOpen} setMenuOpen={setMenuOpen}>Projectes</TopBarItem>
5753
<TopBarItem id='equip' menuOpen={menuOpen} setMenuOpen={setMenuOpen}>Equip</TopBarItem>
58-
{/* Botón resaltado con la prop isHighlight */}
54+
5955
<TopBarItem id='unir-se' menuOpen={menuOpen} setMenuOpen={setMenuOpen} isHighlight>Uneix-te!</TopBarItem>
6056
</div>
6157
</div >

0 commit comments

Comments
 (0)