Skip to content

Commit cfadc84

Browse files
committed
feat(navbar): enhance navbar styles and layout
- Added CSS variables for active navbar link states, improving visual feedback. - Refactored navbar layout for better alignment and responsiveness, including adjustments for mobile and desktop views. - Updated component structure to ensure consistent styling and behavior across different states.
1 parent ba798d7 commit cfadc84

2 files changed

Lines changed: 111 additions & 107 deletions

File tree

app/globals.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,21 @@ input[type='number'] {
412412
transition: all 0.5s ease-out;
413413
}
414414

415+
/* Navbar active state – brand color via CSS variables (Tailwind-safe) */
416+
:root {
417+
--nav-active-bg: rgba(167, 249, 80, 0.1);
418+
--nav-active-color: #a7f950;
419+
--nav-active-border: rgba(167, 249, 80, 0.2);
420+
--nav-active-shadow: 0 1px 2px rgba(167, 249, 80, 0.05);
421+
}
422+
423+
.navbar-link-active {
424+
background-color: var(--nav-active-bg);
425+
color: var(--nav-active-color);
426+
border: 1px solid var(--nav-active-border);
427+
box-shadow: var(--nav-active-shadow);
428+
}
429+
415430
/* Navbar character animations */
416431
.nav-char {
417432
display: inline-block;

components/landing-page/navbar.tsx

Lines changed: 96 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
User as UserIcon,
1010
LogOut,
1111
Settings,
12-
Sparkles,
1312
Wand2,
1413
} from 'lucide-react';
1514
import Image from 'next/image';
@@ -83,9 +82,8 @@ export function Navbar() {
8382
{/* Desktop Navigation */}
8483
<DesktopMenu items={MENU_ITEMS} currentPath={pathname} />
8584

86-
{/* Desktop Actions - Updated with better alignment */}
87-
{/* <div className='flex items-center gap-2'> */}
88-
<div className='hidden shrink-0 min-[990px]:flex md:items-center md:gap-3'>
85+
{/* Desktop Actions: single flex group for correct layout */}
86+
<div className='hidden shrink-0 items-center gap-2 lg:flex lg:gap-3'>
8987
{isLoading ? (
9088
<LoadingSkeleton />
9189
) : isAuthenticated ? (
@@ -95,13 +93,29 @@ export function Navbar() {
9593
)}
9694
</div>
9795

98-
{/* Mobile Menu */}
99-
<MobileMenu
100-
isAuthenticated={isAuthenticated}
101-
isLoading={isLoading}
102-
user={user}
103-
/>
104-
{/* </div> */}
96+
{/* Mobile: right-aligned group — notification, wallet (if auth), hamburger; placeholders when loading to avoid layout jump */}
97+
<div className='flex shrink-0 items-center justify-end gap-2 lg:hidden'>
98+
{isAuthenticated && isLoading && (
99+
<div className='flex items-center gap-2' aria-hidden>
100+
<span className='h-11 w-11 shrink-0 animate-pulse rounded-lg border border-white/10 bg-white/5' />
101+
<span className='h-11 w-11 shrink-0 animate-pulse rounded-lg border border-white/10 bg-white/5' />
102+
</div>
103+
)}
104+
{isAuthenticated && !isLoading && (
105+
<>
106+
<NotificationBell
107+
className='flex min-h-[44px] min-w-[44px] items-center justify-center rounded-lg border border-white/20 p-2.5 text-white/70 transition-colors hover:border-white/30 hover:bg-white/5 hover:text-white'
108+
limit={10}
109+
/>
110+
<WalletTrigger variant='icon' drawerType='family' />
111+
</>
112+
)}
113+
<MobileMenu
114+
isAuthenticated={isAuthenticated}
115+
isLoading={isLoading}
116+
user={user}
117+
/>
118+
</div>
105119
</div>
106120
</div>
107121
</nav>
@@ -142,7 +156,7 @@ function DesktopMenu({
142156
}) {
143157
return (
144158
<nav
145-
className='hidden flex-1 min-[990px]:flex md:items-center md:justify-center'
159+
className='hidden flex-1 items-center justify-center lg:flex'
146160
aria-label='Main navigation'
147161
>
148162
<div className='flex items-center gap-1'>
@@ -156,24 +170,9 @@ function DesktopMenu({
156170
className={cn(
157171
'rounded-lg px-3 py-2 text-sm font-medium transition-all duration-100',
158172
isActive
159-
? `bg-[${BRAND_COLOR}]/10 text-[${BRAND_COLOR}] border border-[${BRAND_COLOR}]/20 shadow-sm shadow-[${BRAND_COLOR}]/5`
160-
: 'text-white/60 hover:bg-white/5 hover:text-white/90',
161-
item.href === '/bounties'
162-
? 'max-[1200px]:hidden'
163-
: item.href === '/blog'
164-
? 'max-[1200px]:hidden'
165-
: ''
173+
? 'navbar-link-active'
174+
: 'text-white/60 hover:bg-white/5 hover:text-white/90'
166175
)}
167-
style={
168-
isActive
169-
? {
170-
backgroundColor: `${BRAND_COLOR}1A`,
171-
color: BRAND_COLOR,
172-
borderColor: `${BRAND_COLOR}33`,
173-
boxShadow: `0 1px 2px ${BRAND_COLOR}0D`,
174-
}
175-
: undefined
176-
}
177176
>
178177
{item.label}
179178
</Link>
@@ -212,14 +211,17 @@ function AuthenticatedActions() {
212211
<>
213212
<div className='flex items-center gap-2'>
214213
<WalletTrigger variant='icon' drawerType='sheet' />
215-
214+
<NotificationBell
215+
className='rounded-lg border border-white/20 p-2 text-white/70 transition-colors hover:border-white/30 hover:bg-white/5 hover:text-white'
216+
limit={10}
217+
/>
216218
<DropdownMenu>
217219
<DropdownMenuTrigger asChild>
218220
<BoundlessButton
219221
variant='outline'
220222
size='sm'
221223
aria-label='Create new content'
222-
className='group relative flex items-center gap-2 overflow-hidden rounded-lg border-white/20 bg-linear-to-r from-transparent via-white/5 to-transparent py-4 text-sm font-medium text-white/90 transition-all duration-300'
224+
className='group relative flex items-center gap-2 overflow-hidden rounded-lg border-white/20 bg-transparent px-3 py-2 text-sm font-medium text-white/90 transition-all duration-200 hover:bg-white/5'
223225
onMouseEnter={e => {
224226
setIsHovered(true);
225227
e.currentTarget.style.backgroundColor = `${BRAND_COLOR}1A`;
@@ -233,13 +235,8 @@ function AuthenticatedActions() {
233235
e.currentTarget.style.color = '';
234236
}}
235237
>
236-
{/* Animated sparkle that travels across */}
237-
<div className='absolute top-1/2 -right-4 h-8 w-8 -translate-y-1/2 opacity-0 transition-all duration-500 group-hover:right-full group-hover:opacity-100'>
238-
<Sparkles className='h-3 w-3 text-[#a7f950]' />
239-
</div>
240-
241238
<Wand2
242-
className={`h-4 w-4 transition-all duration-300 ${isHovered ? 'rotate-12' : ''}`}
239+
className={`h-4 w-4 transition-transform duration-200 ${isHovered ? 'rotate-12' : ''}`}
243240
/>
244241
<span>Create</span>
245242
</BoundlessButton>
@@ -270,8 +267,7 @@ function AuthenticatedActions() {
270267
</DropdownMenuItem>
271268
<DropdownMenuItem asChild>
272269
<Link
273-
href='/organizations/new'
274-
target='_blank'
270+
href='/grants'
275271
className='text-white/80 hover:bg-white/5 hover:text-white focus:bg-white/5 focus:text-white'
276272
>
277273
<Building2 className='mr-2 h-4 w-4' />
@@ -282,14 +278,16 @@ function AuthenticatedActions() {
282278
</DropdownMenuContent>
283279
</DropdownMenu>
284280

285-
<UserMenu />
281+
<UserMenu
282+
triggerClassName='flex items-center gap-2 rounded-lg border border-white/20 bg-white/5 p-1 transition-colors hover:border-white/30 hover:bg-white/10'
283+
contentClassName='w-64 rounded-xl border border-white/10 bg-background-main-bg/98 p-0 shadow-xl shadow-black/40 backdrop-blur-xl'
284+
/>
286285
</div>
287286

288287
<CreateProjectModal
289288
open={createProjectModalOpen}
290289
setOpen={setCreateProjectModalOpen}
291290
/>
292-
<NotificationBell limit={10} />
293291
<WalletRequiredModal
294292
open={showWalletModal}
295293
onOpenChange={closeWalletModal}
@@ -310,12 +308,20 @@ function UnauthenticatedActions() {
310308

311309
return (
312310
<>
313-
<Link
314-
href='/auth?mode=signin'
315-
className='inline-flex h-8 items-center justify-center gap-2 rounded-[10px] bg-[#a7f950] px-3 text-sm font-medium whitespace-nowrap text-black shadow-sm shadow-[#a7f950]/20 transition-all hover:bg-[#a7f950]/90'
316-
>
317-
Sign In
318-
</Link>
311+
<div className='flex items-center gap-2'>
312+
<Link
313+
href='/auth?mode=signin'
314+
className='inline-flex h-9 min-h-[44px] items-center justify-center rounded-[10px] border border-white/30 px-4 text-sm font-medium text-white transition-colors hover:border-white/40 hover:bg-white/10'
315+
>
316+
Sign In
317+
</Link>
318+
<Link
319+
href='/auth?mode=signup'
320+
className='inline-flex h-9 min-h-[44px] items-center justify-center rounded-[10px] bg-[#a7f950] px-4 text-sm font-medium text-black shadow-sm shadow-[#a7f950]/20 transition-colors hover:bg-[#a7f950]/90'
321+
>
322+
Get Started
323+
</Link>
324+
</div>
319325

320326
<CreateProjectModal
321327
open={createProjectModalOpen}
@@ -358,14 +364,14 @@ const MobileMenu = ({
358364
const kycBadge = getKycImageAndAlt(kycStatus);
359365

360366
return (
361-
<div className='min-[990px]:hidden'>
367+
<div className='lg:hidden'>
362368
<Sheet open={isOpen} onOpenChange={setIsOpen}>
363369
<SheetTrigger asChild>
364370
<BoundlessButton
365371
variant='outline'
366372
size='sm'
367373
aria-label='Open navigation menu'
368-
className='border-white/20 transition-all duration-200'
374+
className='min-h-[44px] min-w-[44px] border-white/20 transition-all duration-200'
369375
style={
370376
{
371377
'--hover-bg': `${BRAND_COLOR}1A`,
@@ -390,10 +396,10 @@ const MobileMenu = ({
390396

391397
<SheetContent
392398
side='right'
393-
className='bg-background-main-bg flex w-full flex-col border-l border-white/10 px-5 pt-10 sm:max-w-md'
399+
className='bg-background-main-bg flex w-full max-w-[100vw] flex-col border-l border-white/10 px-5 pt-10 sm:max-w-md'
394400
showCloseButton={true}
395401
>
396-
<div className='flex flex-1 flex-col gap-6 overflow-y-auto pb-6'>
402+
<div className='flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto pb-4'>
397403
{isAuthenticated && user && (
398404
<div className='flex items-center gap-3 rounded-lg border border-white/10 bg-white/5 p-4 transition-colors hover:bg-white/8'>
399405
<span className='relative shrink-0'>
@@ -442,7 +448,6 @@ const MobileMenu = ({
442448
</div>
443449
)}
444450

445-
{/* Navigation Links */}
446451
<nav className='flex flex-col gap-1' aria-label='Mobile navigation'>
447452
{MENU_ITEMS.map(item => {
448453
const isActive = pathname === item.href;
@@ -453,82 +458,66 @@ const MobileMenu = ({
453458
onClick={() => setIsOpen(false)}
454459
aria-current={isActive ? 'page' : undefined}
455460
className={cn(
456-
'rounded-lg py-3 text-sm font-medium transition-all duration-200',
461+
'flex min-h-[44px] items-center rounded-lg border px-3 py-3 text-sm font-medium transition-all duration-200',
457462
isActive
458-
? 'border'
459-
: 'text-white/70 hover:border hover:border-white/10 hover:bg-white/5 hover:text-white/90'
463+
? 'navbar-link-active'
464+
: 'text-white/70 hover:border-white/10 hover:bg-white/5 hover:text-white/90'
460465
)}
461-
style={
462-
isActive
463-
? {
464-
backgroundColor: `${BRAND_COLOR}1A`,
465-
color: BRAND_COLOR,
466-
borderColor: `${BRAND_COLOR}33`,
467-
}
468-
: undefined
469-
}
470466
>
471467
{item.label}
472468
</Link>
473469
);
474470
})}
475471
</nav>
476472

477-
{isAuthenticated && (
478-
<div className='flex flex-col gap-3 border-t border-white/10 pt-6'>
479-
{isLoading ? (
480-
<LoadingSkeleton />
481-
) : (
482-
<>
483-
<WalletTrigger variant='icon' drawerType='family' />
484-
{user?.username && (
485-
<Link
486-
href={`/profile/${user.username}`}
487-
onClick={() => setIsOpen(false)}
488-
>
489-
<BoundlessButton variant='outline' className='w-full'>
490-
<UserIcon className='mr-2 h-4 w-4' />
491-
Profile
492-
</BoundlessButton>
493-
</Link>
494-
)}
495-
<Link href='/me/settings' onClick={() => setIsOpen(false)}>
496-
<BoundlessButton variant='outline' className='w-full'>
497-
<Settings className='mr-2 h-4 w-4' />
498-
Settings
499-
</BoundlessButton>
500-
</Link>
501-
<BoundlessButton
502-
variant='outline'
503-
className='w-full border-red-500/50 text-red-400 hover:bg-red-500/10'
504-
onClick={() => {
505-
logout();
506-
setIsOpen(false);
507-
}}
508-
>
509-
<LogOut className='mr-2 h-4 w-4' />
510-
Sign Out
511-
</BoundlessButton>
512-
</>
513-
)}
514-
</div>
515-
)}
473+
{isAuthenticated && isLoading && <LoadingSkeleton />}
516474
</div>
517475

518-
{/* Sign Up / Sign In Buttons - Fixed at bottom for unauthenticated users */}
476+
{/* Bottom: account actions – Profile, Settings, Sign Out (authenticated) or Get Started + Sign In (unauthenticated) */}
477+
{isAuthenticated && !isLoading && (
478+
<div className='shrink-0 border-t border-white/10 pt-4 pb-6'>
479+
{user?.username && (
480+
<Link
481+
href={`/profile/${user.username}`}
482+
onClick={() => setIsOpen(false)}
483+
className='mb-3 flex min-h-[44px] w-full items-center justify-center rounded-[10px] border border-white/30 px-4 py-3 text-sm font-medium text-white transition-colors hover:border-white/40 hover:bg-white/10'
484+
>
485+
Profile
486+
</Link>
487+
)}
488+
<Link
489+
href='/me/settings'
490+
onClick={() => setIsOpen(false)}
491+
className='mb-3 flex min-h-[44px] w-full items-center justify-center rounded-[10px] border border-white/30 px-4 py-3 text-sm font-medium text-white transition-colors hover:border-white/40 hover:bg-white/10'
492+
>
493+
Settings
494+
</Link>
495+
<button
496+
type='button'
497+
className='flex min-h-[44px] w-full items-center justify-center rounded-[10px] border border-red-500/50 bg-transparent px-4 py-3 text-sm font-medium text-red-400 transition-colors hover:bg-red-500/10'
498+
onClick={() => {
499+
logout();
500+
setIsOpen(false);
501+
}}
502+
>
503+
Sign Out
504+
</button>
505+
</div>
506+
)}
507+
519508
{!isAuthenticated && (
520-
<div className='mt-auto flex flex-col gap-3 border-t border-white/10 pt-6 pb-6'>
509+
<div className='mt-auto flex shrink-0 flex-col gap-3 border-t border-white/10 pt-6 pb-6'>
521510
<Link
522511
href='/auth?mode=signup'
523512
onClick={() => setIsOpen(false)}
524-
className='inline-flex h-9 w-full items-center justify-center gap-2 rounded-[10px] bg-[#a7f950] px-4 py-2 text-sm font-medium whitespace-nowrap text-black shadow-sm shadow-[#a7f950]/20 transition-all hover:bg-[#a7f950]/90'
513+
className='inline-flex min-h-[44px] w-full items-center justify-center rounded-[10px] bg-[#a7f950] px-4 py-3 text-sm font-medium text-black shadow-sm shadow-[#a7f950]/20 transition-colors hover:bg-[#a7f950]/90'
525514
>
526515
Get Started
527516
</Link>
528517
<Link
529518
href='/auth?mode=signin'
530519
onClick={() => setIsOpen(false)}
531-
className='inline-flex h-9 w-full items-center justify-center gap-2 rounded-[10px] border border-white/30 px-4 py-2 text-sm font-medium whitespace-nowrap text-white transition-all hover:border-white/40 hover:bg-white/10'
520+
className='inline-flex min-h-[44px] w-full items-center justify-center rounded-[10px] border border-white/30 px-4 py-3 text-sm font-medium text-white transition-colors hover:border-white/40 hover:bg-white/10'
532521
>
533522
Sign In
534523
</Link>

0 commit comments

Comments
 (0)