24 lines
688 B
TypeScript
24 lines
688 B
TypeScript
|
|
import { cva } from "class-variance-authority";
|
||
|
|
import { STATUS_META, type ServiceStatus } from "../../lib/model";
|
||
|
|
|
||
|
|
const statusBadgeVariants = cva(
|
||
|
|
"inline-flex items-center gap-1.5 whitespace-nowrap text-xs font-semibold before:size-1.5 before:rounded-full before:bg-current before:content-['']",
|
||
|
|
{
|
||
|
|
variants: {
|
||
|
|
status: {
|
||
|
|
running: "text-brand",
|
||
|
|
stopped: "text-muted",
|
||
|
|
faulted: "text-coral-strong",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
);
|
||
|
|
|
||
|
|
export function StatusBadge(props: { status: ServiceStatus }) {
|
||
|
|
return (
|
||
|
|
<span data-slot="service-status" class={statusBadgeVariants({ status: props.status })}>
|
||
|
|
{STATUS_META[props.status].label}
|
||
|
|
</span>
|
||
|
|
);
|
||
|
|
}
|