eny.space Landingpage
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'feature/mobile-menu' into develop

+88 -4
+75
app/components/site-header/mobile-menu.tsx
··· 1 + import Link from "next/link"; 2 + import type { User } from "@supabase/supabase-js"; 3 + 4 + import { signOut } from "@/actions/auth"; 5 + 6 + interface MobileMenuProps { 7 + user: User | null; 8 + open: boolean; 9 + onClose: () => void; 10 + } 11 + 12 + const mobileLinkClass = 13 + "block text-left text-base font-medium text-white/90 hover:text-white"; 14 + 15 + export function MobileMenu({ user, open, onClose }: MobileMenuProps) { 16 + if (!open) return null; 17 + 18 + return ( 19 + <div className="fixed right-0 top-14 z-40 max-h-[calc(100vh-3.5rem)] w-1/3 overflow-y-auto border-t border-white/10 bg-neutral-950 px-4 pb-4 pt-3 md:hidden"> 20 + <nav className="flex flex-col gap-2"> 21 + <Link 22 + href="/" 23 + className={mobileLinkClass} 24 + onClick={onClose} 25 + > 26 + Home 27 + </Link> 28 + {user && ( 29 + <Link 30 + href="/dashboard" 31 + className={mobileLinkClass} 32 + onClick={onClose} 33 + > 34 + Dashboard 35 + </Link> 36 + )} 37 + <Link 38 + href="/#about" 39 + className={mobileLinkClass} 40 + onClick={onClose} 41 + > 42 + About 43 + </Link> 44 + </nav> 45 + 46 + <div className="mt-3 flex flex-col gap-2"> 47 + {user ? ( 48 + <form action={signOut}> 49 + <button type="submit" className={mobileLinkClass}> 50 + Sign out 51 + </button> 52 + </form> 53 + ) : ( 54 + <> 55 + <Link 56 + href="/login" 57 + onClick={onClose} 58 + className={mobileLinkClass} 59 + > 60 + Login 61 + </Link> 62 + <Link 63 + href="/signup" 64 + onClick={onClose} 65 + className={mobileLinkClass} 66 + > 67 + Get started 68 + </Link> 69 + </> 70 + )} 71 + </div> 72 + </div> 73 + ); 74 + } 75 +
+13 -4
app/components/site-header/site-header.tsx
··· 7 7 import { Button } from "@/actions/components/ui/button"; 8 8 import { ArrowUpRightIcon, MenuIcon, XIcon } from "lucide-react"; 9 9 import type { User } from "@supabase/supabase-js"; 10 + import { MobileMenu } from "./mobile-menu"; 10 11 11 12 interface SiteHeaderProps { 12 13 user: User | null; ··· 155 156 </div> 156 157 157 158 <button 158 - className="md:hidden text-white" 159 - onClick={() => setMobileOpen(!mobileOpen)} 159 + type="button" 160 + aria-label="Toggle navigation" 161 + className="inline-flex h-9 w-9 cursor-pointer items-center justify-center text-white md:hidden" 162 + onClick={() => setMobileOpen((open) => !open)} 160 163 > 161 164 {mobileOpen ? ( 162 - <XIcon className="size-5" /> 165 + <XIcon className="size-5" aria-hidden /> 163 166 ) : ( 164 - <MenuIcon className="size-5" /> 167 + <MenuIcon className="size-5" aria-hidden /> 165 168 )} 166 169 </button> 167 170 </div> 171 + 172 + <MobileMenu 173 + user={user} 174 + open={mobileOpen} 175 + onClose={() => setMobileOpen(false)} 176 + /> 168 177 </header> 169 178 ); 170 179 }