({
icon: Icon,
onClick,
variant = "secondary",
disabled = false,
title,
children,
}: {
icon: LucideIcon;
onClick: () => void;
variant?: "primary" | "secondary";
disabled?: boolean;
title?: string;
children: ReactNode;
})
| 8 | // A toolbar action: leading icon + label. `primary` is the accent-filled variant |
| 9 | // (use for the one default action, Save); everything else is `secondary`. |
| 10 | export function ToolbarButton({ |
| 11 | icon: Icon, |
| 12 | onClick, |
| 13 | variant = "secondary", |
| 14 | disabled = false, |
| 15 | title, |
| 16 | children, |
| 17 | }: { |
| 18 | icon: LucideIcon; |
| 19 | onClick: () => void; |
| 20 | variant?: "primary" | "secondary"; |
| 21 | disabled?: boolean; |
| 22 | title?: string; |
| 23 | children: ReactNode; |
| 24 | }) { |
| 25 | const tone = |
| 26 | variant === "primary" |
| 27 | ? "bg-primary text-primary-foreground hover:opacity-90" |
| 28 | : "bg-secondary text-secondary-foreground hover:bg-muted"; |
| 29 | return ( |
| 30 | <button |
| 31 | onClick={onClick} |
| 32 | disabled={disabled} |
| 33 | title={title} |
| 34 | className={`inline-flex items-center gap-1.5 px-3 py-1 text-sm rounded border border-border transition-colors disabled:opacity-40 disabled:pointer-events-none ${tone}`} |
| 35 | > |
| 36 | <Icon className="w-4 h-4" /> |
| 37 | {children} |
| 38 | </button> |
| 39 | ); |
| 40 | } |
nothing calls this directly
no outgoing calls
no test coverage detected