Repository Public
1import Link from "next/link";2import type { ReactNode } from "react";3import type { Locale } from "@/schema";4import { dict } from "@/i18n/dict";5import { Signature, Wordmark } from "@/components/brand";6import { LocaleSwitch, ModeToggle, RegisterSw } from "./controls";78const T = dict({9 skip: ["Aller au contenu", "Skip to content"], sheets: ["Fiches", "Sheets"], topics: ["Thèmes", "Topics"], search: ["Recherche", "Search"], about: ["À propos", "About"],10 nav: ["Navigation principale", "Main navigation"], footer: ["Fiches scientifiques, techniques et pédagogiques, en lecture libre.", "Scientific, technical and teaching sheets, free to read."],11 rss: ["Flux RSS", "RSS feed"], rights: ["Tous droits réservés.", "All rights reserved."], home: ["Accueil de Sheet", "Sheet home"],12});1314export function SiteChrome({ locale, children }: { locale: Locale; children: ReactNode }) {15 const t = T(locale);16 const links = [["/", t.sheets], ["/topics", t.topics], ["/search", t.search], ["/about", t.about]] as const;17 return (18 <div className="flex min-h-dvh flex-col">19 <a href="#content" className="sr-only focus:not-sr-only focus:fixed focus:left-3 focus:top-3 focus:z-50 btn btn-primary">{t.skip}</a>20 <header className="no-print sticky top-0 z-40 border-b border-line bg-paper/90 backdrop-blur supports-[backdrop-filter]:bg-paper/75" style={{ paddingTop: "env(safe-area-inset-top)" }}>21 <div className="mx-auto flex h-14 max-w-[1240px] items-center gap-2 safe-x">22 <Link href="/" aria-label={t.home} className="mr-auto rounded-lg"><Wordmark /></Link>23 <nav aria-label={t.nav} className="hidden items-center sm:flex">24 {links.map(([href, label]) => <Link key={href} href={href} className="rounded-lg px-3 py-2.5 text-[0.9375rem] font-medium text-muted hover:text-ink">{label}</Link>)}25 </nav>26 <LocaleSwitch /><ModeToggle />27 </div>28 {/* Phones: the same four destinations, always visible, thumb-sized. */}29 <nav aria-label={t.nav} className="flex border-t border-line sm:hidden">30 {links.map(([href, label]) => <Link key={href} href={href} className="flex min-h-11 flex-1 items-center justify-center text-sm font-medium text-muted">{label}</Link>)}31 </nav>32 </header>33 <main id="content" className="flex-1">{children}</main>34 <footer className="no-print mt-16 border-t border-line">35 <div className="mx-auto flex max-w-[1240px] flex-col gap-4 py-8 text-sm text-muted safe-x sm:flex-row sm:items-center sm:justify-between safe-b">36 <div>37 <Signature className="text-ink" />38 <p className="mt-1">{t.footer}</p>39 </div>40 <div className="flex flex-wrap items-center gap-x-5 gap-y-2">41 <Link href="/about" className="py-2 hover:text-ink">{t.about}</Link>42 <a href="/rss.xml" className="py-2 hover:text-ink">{t.rss}</a>43 <span>© {new Date().getFullYear()} Simon-Pierre Boucher. {t.rights}</span>44 </div>45 </div>46 </footer>47 <RegisterSw />48 </div>49 );50}51