Skip to content

Commit 6650c42

Browse files
committed
fix(navbar): improper border color, alignment and layout issues
1 parent 035b782 commit 6650c42

File tree

4 files changed

+47
-41
lines changed

4 files changed

+47
-41
lines changed

package-lock.json

Lines changed: 1 addition & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/constants/Header.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ export const navigationData = {
1111
],
1212
},
1313
},
14-
1514
links: [
1615
{ label: 'News', path: '/news' },
1716
{ label: 'Merchandise', path: '/products' },
1817
{ label: 'Donate', path: '/donate' },
1918
{ label: 'Join Development', path: '/join-development' },
2019
{ label: 'Volunteer', path: '/volunteer' },
2120
],
21+
linksBefore:[
22+
{ label: 'Home', path: '/' },
23+
],
2224
};

src/sections/Header.tsx

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@ const Header: React.FC = () => {
6464
return (
6565
<>
6666
<header
67-
className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${
68-
isScrolled
67+
className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${isScrolled
6968
? 'backdrop-blur-md bg-white/90 dark:bg-gray-900/80 shadow-lg'
7069
: 'bg-white dark:bg-gray-900'
71-
}`}
70+
}`}
7271
>
7372
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
7473
<div className="flex justify-between items-center h-16 md:h-20">
@@ -81,7 +80,7 @@ const Header: React.FC = () => {
8180
<img
8281
src={logo}
8382
alt="Sugar Labs"
84-
className="h-8 md:h-12 w-auto transition-transform hover:scale-105"
83+
className="h-8 md:h-12 w-auto transition-transform"
8584
/>
8685
</Link>
8786

@@ -94,29 +93,39 @@ const Header: React.FC = () => {
9493
>
9594
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2">
9695
<span
97-
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 ${
98-
isMobileMenuOpen
96+
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 ${isMobileMenuOpen
9997
? 'rotate-45 translate-y-1.5'
10098
: 'translate-y-[-4px]'
101-
}`}
99+
}`}
102100
/>
103101
<span
104-
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 mt-1 ${
105-
isMobileMenuOpen ? 'opacity-0' : ''
106-
}`}
102+
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 mt-1 ${isMobileMenuOpen ? 'opacity-0' : ''
103+
}`}
107104
/>
108105
<span
109-
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 mt-1 ${
110-
isMobileMenuOpen
106+
className={`block w-6 h-0.5 bg-gray-600 dark:bg-gray-200 transition-all duration-300 mt-1 ${isMobileMenuOpen
111107
? '-rotate-45 -translate-y-1.5'
112108
: 'translate-y-[4px]'
113-
}`}
109+
}`}
114110
/>
115111
</div>
116112
</button>
117113

118-
{/* Desktop Navigation (visible from lg and up) */}
114+
115+
{/* Regular links */}
119116
<nav className="hidden lg:flex lg:items-center lg:space-x-4">
117+
{navigationData.linksBefore.map((link) => (
118+
<Link
119+
key={link.label}
120+
to={link.path}
121+
className="px-2 lg:px-2 py-2 text-gray-700 dark:text-gray-200 hover:text-blue-600 font-medium rounded-md
122+
transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-800 text-sm lg:text-sm whitespace-nowrap"
123+
onClick={handleNavigation}
124+
>
125+
{link.label}
126+
</Link>
127+
))}
128+
{/* Desktop Navigation (visible from lg and up) */}
120129
{/* Dropdown menus */}
121130
{Object.entries(navigationData.dropdowns).map(
122131
([key, dropdown]) => (
@@ -145,7 +154,7 @@ const Header: React.FC = () => {
145154
</Link>
146155
))}
147156

148-
<div className="flex items-center gap-3">
157+
<div className="flex items-center lg:ml-13 gap-3">
149158
<DarkModeToggle />
150159

151160
{/* CTA Button (slightly reduced padding at lg so it fits tighter layouts) */}
@@ -210,14 +219,27 @@ const MobileNavDrawer: React.FC<{
210219
transition={{ type: 'tween', duration: 0.3 }}
211220
className="fixed lg:hidden top-0 right-0 bottom-0 w-[80%] max-w-sm bg-white dark:bg-gray-900 shadow-xl z-40 flex flex-col h-full"
212221
>
222+
213223
<div className="flex flex-col h-full">
214224
{/* Space to avoid overlay with main header */}
215225
<div className="h-16" />
216226

217227
{/* Scrollable content area */}
218228
<div className="flex-1 overflow-y-auto py-2">
229+
219230
<div className="space-y-4">
220231
{/* Dropdown menus */}
232+
{navigationData.linksBefore.map((link) => (
233+
<Link
234+
key={link.label}
235+
to={link.path}
236+
onClick={onClose}
237+
className="block px-4 py-2 text-gray-700 dark:text-gray-200 font-medium rounded-lg
238+
hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-blue-600"
239+
>
240+
{link.label}
241+
</Link>
242+
))}
221243
{Object.entries(navigationData.dropdowns).map(
222244
([key, dropdown]) => (
223245
<div key={key} className="space-y-1 px-2">
@@ -231,9 +253,8 @@ const MobileNavDrawer: React.FC<{
231253
>
232254
<span>{dropdown.label}</span>
233255
<svg
234-
className={`w-5 h-5 transition-transform duration-200 ${
235-
activeDropdown === key ? 'rotate-180' : ''
236-
}`}
256+
className={`w-5 h-5 transition-transform duration-200 ${activeDropdown === key ? 'rotate-180' : ''
257+
}`}
237258
fill="none"
238259
viewBox="0 0 24 24"
239260
stroke="currentColor"
@@ -282,7 +303,7 @@ const MobileNavDrawer: React.FC<{
282303
key={link.label}
283304
to={link.path}
284305
onClick={onClose}
285-
className="block px-4 py-2 text-gray-700 dark:text-gray-200 font-medium rounded-lg
306+
className="block px-4 py-2 text-gray-700 dark:text-gray-200 font-medium rounded-lg
286307
hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-blue-600"
287308
>
288309
{link.label}

src/sections/NavDropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const NavDropdown: React.FC<NavDropdownProps> = ({
2626
onMouseLeave={() => setActive(null)}
2727
>
2828
<button
29-
className={`px-2 lg:px-3 py-2 text-gray-700 dark:text-gray-200 hover:text-blue-600 font-medium rounded-md
29+
className={`px-2 lg:px-3 py-2 text-sm lg:text-sm text-gray-700 dark:text-gray-200 hover:text-blue-600 font-medium rounded-md cursor-pointer
3030
transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center space-x-1
3131
${isActive ? 'text-blue-600 dark:text-blue-400' : ''}`}
3232
aria-expanded={isActive}
@@ -54,7 +54,7 @@ const NavDropdown: React.FC<NavDropdownProps> = ({
5454
animate={{ opacity: 1, y: 0 }}
5555
exit={{ opacity: 0, y: 10 }}
5656
transition={{ duration: 0.2 }}
57-
className="absolute left-0 mt-[0.074rem] w-56 rounded-xl bg-white dark:bg-gray-800 shadow-xl ring-1 ring-black dark:ring-white ring-opacity-5 dark:ring-opacity-10 overflow-hidden"
57+
className="absolute left-0 mt-[0.779rem] w-56 rounded-xl bg-white dark:bg-gray-800 shadow-xl ring-1 ring-zinc-300/50 dark:ring-white/20 ring-opacity-5 overflow-hidden"
5858
>
5959
<div className="py-2">
6060
{items.map((item) => (
@@ -66,7 +66,7 @@ const NavDropdown: React.FC<NavDropdownProps> = ({
6666
transition-all duration-200 hover:text-blue-600 dark:hover:text-blue-400"
6767
>
6868
<span
69-
className="w-2 h-2 rounded-full bg-blue-600 opacity-0 group-hover:opacity-100
69+
className="w-2 h-2 rounded-full bg-blue-600 opacity-0 group-hover:opacity-100
7070
transition-all duration-200 mr-2 transform scale-0 group-hover:scale-100"
7171
/>
7272
{item.label}

0 commit comments

Comments
 (0)