import type { ComponentType } from "react"; import type { LucideProps } from "lucide-react"; import { ArrowLeft } from "lucide-react"; import { Link } from "react-router"; import { cn } from "~/lib/utils"; type SettingsNavSection = { id: string; label: string; }; export type SettingsGridSection = SettingsNavSection & { icon: ComponentType; subtitle: string; isDanger?: boolean; }; export function SettingsMobileGridNav({ sections, onSectionChange, buildHref, }: { sections: readonly SettingsGridSection[]; onSectionChange?: (sectionId: string) => void; buildHref?: (sectionId: string) => string; }) { const cardClassName = (section: SettingsGridSection) => cn( "flex cursor-pointer flex-col gap-3 rounded-xl border bg-card p-4 text-left transition-colors hover:border-primary/40 active:scale-[0.98]", section.isDanger && "border-destructive/40" ); const cardInner = (section: SettingsGridSection) => ( <>

{section.label}

{section.subtitle}

); return (

Manage

{sections.map((section) => buildHref ? ( {cardInner(section)} ) : ( ) )}
); } export function SettingsMobileSectionPill({ onShowGrid, backHref, }: { onShowGrid?: () => void; backHref?: string; }) { const className = "flex cursor-pointer items-center gap-1.5 rounded-full border bg-card px-3 py-1.5 text-sm font-medium hover:bg-muted"; const content = ( <> Back to all settings ); return (
{backHref ? ( {content} ) : ( )}
); } export function SettingsDesktopNav({ sections, activeSection, onSectionChange, buildHref, navLabel = "League settings", }: { sections: readonly SettingsGridSection[]; activeSection: string; onSectionChange?: (sectionId: string) => void; buildHref?: (sectionId: string) => string; navLabel?: string; }) { const itemClassName = (section: SettingsGridSection) => cn( "flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-left text-sm font-medium text-muted-foreground hover:bg-muted hover:text-foreground", activeSection === section.id && "bg-muted text-foreground" ); const itemInner = (section: SettingsGridSection) => ( <>