|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { useRouter } from "next/navigation"; |
| 4 | + |
| 5 | +import { Button } from "@/components/core"; |
| 6 | +import { useViewport } from "@/lib/hooks/useViewport"; |
| 7 | + |
| 8 | +/** |
| 9 | + * Sticky navigation bar for unauthenticated visitors. |
| 10 | + * Shows the UoN logo and Matchboard branding with Sign in / Sign up buttons. |
| 11 | + * Excludes search, notifications, and user-specific controls. |
| 12 | + */ |
| 13 | +export function LandingTopBar() { |
| 14 | + const router = useRouter(); |
| 15 | + const { isMobile } = useViewport(); |
| 16 | + |
| 17 | + return ( |
| 18 | + <header |
| 19 | + className="sticky top-0 z-10 bg-paper border-b border-[var(--border)] h-[60px] flex items-center" |
| 20 | + style={{ |
| 21 | + padding: isMobile ? "0 16px" : "0 28px", |
| 22 | + gap: isMobile ? 12 : 24, |
| 23 | + }} |
| 24 | + > |
| 25 | + {/* eslint-disable-next-line @next/next/no-img-element */} |
| 26 | + <img |
| 27 | + src="/uon-logo-blue.png" |
| 28 | + alt="University of Nottingham" |
| 29 | + className="object-contain" |
| 30 | + style={{ height: isMobile ? 28 : 34, width: "auto" }} |
| 31 | + /> |
| 32 | + |
| 33 | + {!isMobile && ( |
| 34 | + <> |
| 35 | + <span className="w-px h-7 bg-[var(--border-strong)] shrink-0" /> |
| 36 | + <div className="flex items-center gap-2.5"> |
| 37 | + <MatchboardMark size={22} /> |
| 38 | + <span className="text-[18px] font-semibold tracking-[-0.025em] text-ink"> |
| 39 | + Matchboard |
| 40 | + </span> |
| 41 | + </div> |
| 42 | + <div className="text-[13px] text-ink-soft shrink-0"> |
| 43 | + Digital Research Service |
| 44 | + </div> |
| 45 | + </> |
| 46 | + )} |
| 47 | + |
| 48 | + {isMobile && ( |
| 49 | + <div className="flex items-center gap-1.5"> |
| 50 | + <MatchboardMark size={18} /> |
| 51 | + <span className="text-[16px] font-semibold tracking-[-0.025em] text-ink"> |
| 52 | + Matchboard |
| 53 | + </span> |
| 54 | + </div> |
| 55 | + )} |
| 56 | + |
| 57 | + <div className="flex-1" /> |
| 58 | + |
| 59 | + <div className="flex items-center gap-2"> |
| 60 | + <Button |
| 61 | + variant="secondary" |
| 62 | + size={isMobile ? "sm" : "md"} |
| 63 | + onClick={() => router.push("/sign-in")} |
| 64 | + > |
| 65 | + Sign in |
| 66 | + </Button> |
| 67 | + <Button |
| 68 | + variant="primary" |
| 69 | + size={isMobile ? "sm" : "md"} |
| 70 | + onClick={() => router.push("/sign-up")} |
| 71 | + > |
| 72 | + Sign up |
| 73 | + </Button> |
| 74 | + </div> |
| 75 | + </header> |
| 76 | + ); |
| 77 | +} |
| 78 | + |
| 79 | +function MatchboardMark({ size }: { size: number }) { |
| 80 | + return ( |
| 81 | + <svg |
| 82 | + xmlns="http://www.w3.org/2000/svg" |
| 83 | + viewBox="0 0 24 24" |
| 84 | + width={size} |
| 85 | + height={size} |
| 86 | + aria-hidden="true" |
| 87 | + > |
| 88 | + <circle cx="9" cy="12" r="4" fill="#10263B" /> |
| 89 | + <circle cx="17" cy="12" r="2.5" fill="#DEB406" /> |
| 90 | + </svg> |
| 91 | + ); |
| 92 | +} |
0 commit comments