teecup/frontend/components/tournament-status-badge.tsx

45 lines
1.1 KiB
TypeScript
Raw Normal View History

import { cn } from "@/lib/utils"
export type TournamentStatus = "draft" | "active" | "completed" | "archived"
const STATUS_CONFIG: Record<
TournamentStatus,
{ label: string; dot: string; badge: string }
> = {
draft: {
label: "Utkast",
dot: "bg-muted-foreground",
badge: "bg-muted text-foreground",
},
active: {
label: "Aktiv",
dot: "bg-primary",
badge: "bg-primary/15 text-foreground",
},
completed: {
label: "Fullført",
dot: "bg-brand-orange",
badge: "bg-brand-orange/12 text-foreground",
},
archived: {
label: "Arkivert",
dot: "bg-muted-foreground/50",
badge: "border border-border bg-transparent text-muted-foreground",
},
}
export function TournamentStatusBadge({ status }: { status: TournamentStatus }) {
const config = STATUS_CONFIG[status]
return (
<span
className={cn(
"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold",
config.badge,
)}
>
<span className={cn("size-1.5 rounded-full", config.dot)} aria-hidden="true" />
{config.label}
</span>
)
}