Files
lokiloto/components/country-selector.tsx
T
Nazim KriandClaude Sonnet 5 8621284cab Real design pass: shadcn/ui, dark sportsbook-style UI, per-country accent
Replaces the plain proof-of-concept page with a proper design: shadcn/ui
component foundation, dark theme by default, a brand bar + country
selector pill nav, lottery cards with real number chips and win-state
highlighting, and a shared Loki mark reskinned per country via a single
--accent CSS variable (set from lib/countries.ts's flag-derived OKLCH
palette) — one mascot, one layout, color is the only thing that changes
per country, as specified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-29 21:57:03 -04:00

51 lines
1.6 KiB
TypeScript

"use client"
import Link from "next/link"
import { usePathname, useSearchParams } from "next/navigation"
import { COUNTRIES } from "@/lib/countries"
import { cn } from "@/lib/utils"
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"
export function CountrySelector({ active }: { active: string }) {
const pathname = usePathname()
const searchParams = useSearchParams()
function hrefFor(code: string) {
const params = new URLSearchParams(searchParams.toString())
params.set("country", code)
return `${pathname}?${params.toString()}`
}
return (
<ScrollArea className="w-full">
<nav
aria-label="Sélection du pays"
className="flex items-center gap-1.5 pb-3"
>
{COUNTRIES.map((c) => {
const isActive = c.code === active
return (
<Link
key={c.code}
href={hrefFor(c.code)}
aria-current={isActive ? "page" : undefined}
className={cn(
"flex shrink-0 items-center gap-1.5 rounded-full border px-3.5 py-2 text-sm font-medium transition-colors",
isActive
? "border-accent bg-accent-soft text-foreground"
: "border-border text-muted-foreground hover:border-accent/40 hover:text-foreground"
)}
>
<span aria-hidden className="text-base leading-none">
{c.flagEmoji}
</span>
{c.name}
</Link>
)
})}
</nav>
<ScrollBar orientation="horizontal" />
</ScrollArea>
)
}