SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
906 B · 22 lines tsx
Raw Blame History
1'use client';2import { usePathname, useRouter } from 'next/navigation';34/** Mobile section switcher for the admin shell (< lg): a native select that navigates. */5export function AdminNavSelect({ items }: { items: { href: string; label: string }[] }) {6  const router = useRouter();7  const pathname = usePathname();8  const current = items.find((i) => pathname === i.href || pathname.startsWith(i.href + '/'))?.href ?? items[0]?.href ?? '';9  return (10    <label className="block lg:hidden">11      <span className="sr-only">Admin section</span>12      <select value={current} onChange={(e) => router.push(e.target.value)} className="h-11 w-full border border-rule bg-surface px-2.5 text-sm text-ink focus:border-accent focus:outline-none">13        {items.map((i) => (14          <option key={i.href} value={i.href}>15            {i.label}16          </option>17        ))}18      </select>19    </label>20  );21}22