| 1 | import { cn } from "@/lib/utils"; |
| 2 | import type { EventStatus } from "@/lib/types"; |
| 3 | |
| 4 | |
| 5 | const LABELS: Record<EventStatus, string> = { |
| 6 | announced: "Announced", |
| 7 | presale: "Presale", |
| 8 | onsale: "On Sale", |
| 9 | soldout: "Sold Out", |
| 10 | cancelled: "Cancelled", |
| 11 | }; |
| 12 | |
| 13 | const VARS: Record<EventStatus, string> = { |
| 14 | announced: "var(--color-status-announced)", |
| 15 | presale: "var(--color-status-presale)", |
| 16 | onsale: "var(--color-status-onsale)", |
| 17 | soldout: "var(--color-status-soldout)", |
| 18 | cancelled: "var(--color-status-cancelled)", |
| 19 | }; |
| 20 | |
| 21 | export function StatusPill({ status, className }: { status: EventStatus; className?: string }) { |
| 22 | const c = VARS[status]; |
| 23 | return ( |
| 24 | <span |
| 25 | className={cn( |
| 26 | "inline-flex items-center gap-1.5 rounded-[var(--radius-sm)] px-2.5 py-0.5 text-xs font-medium", |
| 27 | className, |
| 28 | )} |
| 29 | style={{ |
| 30 | color: c, |
| 31 | backgroundColor: `color-mix(in oklch, ${c} 12%, transparent)`, |
| 32 | border: `1px solid color-mix(in oklch, ${c} 25%, transparent)`, |
| 33 | }} |
| 34 | > |
| 35 | <span |
| 36 | className={cn("h-1.5 w-1.5 rounded-full", status === "onsale" && "pulse-ring")} |
| 37 | style={{ backgroundColor: c }} |
| 38 | aria-hidden |
| 39 | /> |
| 40 | {LABELS[status]} |
| 41 | </span> |
| 42 | ); |
| 43 | } |