feat: add Badge, StatusDot, GhButton shared UI primitives

This commit is contained in:
2026-03-21 20:41:06 +01:00
parent 2801f80b9a
commit 1d13def6da
3 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { ServiceStatus } from '@/lib/schemas/server';
import { cn } from '@/lib/utils';
interface StatusDotProps {
status: ServiceStatus;
className?: string;
}
export function StatusDot({ status, className }: StatusDotProps) {
const dotClass = {
[ServiceStatus.Running]: 'bg-gh-green shadow-[0_0_0_3px_#3fb95022]',
[ServiceStatus.Starting]: 'bg-gh-yellow animate-pulse',
[ServiceStatus.Stopping]: 'bg-gh-yellow animate-pulse',
[ServiceStatus.Restarting]: 'bg-gh-yellow animate-pulse',
[ServiceStatus.Stopped]: 'bg-gh-subtle',
[ServiceStatus.Unknown]: 'bg-gh-subtle',
}[status] ?? 'bg-gh-subtle';
return (
<span
className={cn(
'inline-block h-2 w-2 rounded-full flex-shrink-0',
dotClass,
className
)}
/>
);
}