Files
bobinoo/src/components/SideNav.tsx
T
Claude 6bcbc8da69
deploy / deploy (push) Successful in 1m29s
Tablettes et iPad, plus de zoom au doigt, préparation du Play Store
- Plus de zoom au doigt sur téléphone (pincer, double-toucher) : balise
  viewport pour Android, touch-action sur la page, gestes de Safari
  annulés sur iPhone et iPad. Le recadrage de la photo garde son
  pincement.
- Version tablette : dès 704 px (iPad, tablettes Android, téléphones
  en paysage), mise en page grand écran avec une barre latérale étroite
  (icône et libellé) à la place de la barre du bas ; barre complète
  à partir de 1024 px comme avant. Catalogue sur plus de colonnes,
  accueil et fiches en deux colonnes, tuiles des stats sur 2 colonnes
  en portrait.
- Manifeste : orientation libre (tablettes en paysage), identifiant
  et catégorie pour l'app Android.
- Guide Play Store : étapes pour fabriquer et publier l'app Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
2026-12-02 14:42:39 +00:00

62 lines
2.8 KiB
TypeScript

import { type Tab } from './BottomNav'
import { t } from '../i18n'
import { BarChart3, Home, LibraryBig, Search, Settings } from 'lucide-react'
import { cx } from '../lib/utils'
const ITEMS: { tab: Tab; readonly label: string; Icon: typeof Home }[] = [
{ tab: 'home', get label() { return t('nav.home') }, Icon: Home },
{ tab: 'catalog', get label() { return t('nav.catalog') }, Icon: LibraryBig },
{ tab: 'stats', get label() { return t('nav.stats') }, Icon: BarChart3 },
{ tab: 'settings', get label() { return t('nav.settings') }, Icon: Settings },
]
interface Props {
current: Tab
onChange: (tab: Tab) => void
onAdd: () => void
}
/**
* Navigation sur grand écran. Tablette (et téléphone en paysage) : barre étroite, icône au-dessus du libellé.
* Ordinateur (à partir de 1024 px) : barre complète, logo en entier et libellés à côté des icônes.
*/
export default function SideNav({ current, onChange, onAdd }: Props) {
return (
<nav className="no-scrollbar fixed inset-y-0 start-0 z-30 hidden w-20 flex-col items-center overflow-y-auto border-e border-line bg-bg pb-6 pt-[max(1.25rem,env(safe-area-inset-top))] md:flex lg:w-60 lg:items-stretch lg:px-4 lg:pt-6">
<p className="hidden px-2 text-[1.75rem] font-bold leading-none lg:block">
Bobin<span className="text-accent">oo</span>
</p>
<img src="/icons/favicon.svg" alt="Bobinoo" className="size-9 rounded-lg lg:hidden" />
<button
onClick={onAdd}
aria-label={t('search.title')}
className="mt-6 grid size-12 shrink-0 place-items-center rounded-full bg-accent-fill text-on-accent transition active:scale-95 lg:flex lg:h-auto lg:w-full lg:items-center lg:justify-center lg:gap-2 lg:rounded-[4px] lg:px-4 lg:py-2.5 lg:text-sm lg:font-semibold"
>
<Search strokeWidth={2.4} className="size-[22px] lg:size-[17px]" />
<span className="hidden lg:inline">{t('search.title')}</span>
</button>
<div className="mt-6 flex w-full flex-col gap-1">
{ITEMS.map(({ tab, label, Icon }) => {
const active = current === tab
return (
<button
key={tab}
onClick={() => onChange(tab)}
aria-current={active ? 'page' : undefined}
className={cx(
'flex w-full flex-col items-center gap-1 border-s-2 px-1 py-2.5 text-[11px] font-medium transition-colors lg:flex-row lg:gap-3 lg:rounded-md lg:px-3 lg:text-sm',
active ? 'border-accent text-ink lg:bg-surface' : 'border-transparent text-ink-3 hover:text-ink',
)}
>
<Icon size={20} strokeWidth={active ? 2.2 : 1.6} className="shrink-0" />
<span className="max-w-full truncate">{label}</span>
</button>
)
})}
</div>
</nav>
)
}