feat(frontend): Spectrum UX port — Tabs + AlertBanner + BackLink + compact tables (sprint 11) #13

Merged
knacky merged 11 commits from sprint/11-spectrum-ux into main 2026-06-22 08:25:38 +00:00
Showing only changes of commit 59eaa342a9 - Show all commits

View File

@@ -0,0 +1,30 @@
import type { ReactNode } from 'react';
import { AlertCircle, AlertTriangle, CheckCircle, Info } from 'lucide-react';
type AlertVariant = 'error' | 'warn' | 'success' | 'info';
interface AlertBannerProps {
variant: AlertVariant;
title?: string;
children: ReactNode;
}
const CONFIG: Record<AlertVariant, { cls: string; Icon: typeof AlertCircle; role: string }> = {
error: { cls: 'alert-error', Icon: AlertCircle, role: 'alert' },
warn: { cls: 'alert-warn', Icon: AlertTriangle, role: 'alert' },
success: { cls: 'alert-success', Icon: CheckCircle, role: 'status' },
info: { cls: 'alert-info', Icon: Info, role: 'status' },
};
export function AlertBanner({ variant, title, children }: AlertBannerProps): JSX.Element {
const { cls, Icon, role } = CONFIG[variant];
return (
<div role={role} className={cls}>
<Icon size={16} aria-hidden className="mt-[2px] shrink-0" />
<div className="flex flex-col gap-xxs text-[14px]">
{title ? <span className="font-medium text-ink">{title}</span> : null}
<span className="text-charcoal">{children}</span>
</div>
</div>
);
}