add ToggleButton component

This commit is contained in:
Josh Hawkins 2024-10-18 10:05:39 -05:00
parent 8be2851a5a
commit 6ca7b9885c

View File

@ -0,0 +1,29 @@
import { cn } from "@/lib/utils";
export default function ToggleButton({
active,
onClick,
children,
disabled,
}: {
active: boolean;
onClick: () => void;
children: React.ReactNode;
disabled: boolean;
}) {
return (
<button
className={cn(
"rounded-md px-3 py-1 text-sm font-medium transition-colors",
active && !disabled
? "bg-selected text-white"
: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
disabled && "cursor-not-allowed opacity-50",
)}
onClick={onClick}
disabled={disabled}
>
{children}
</button>
);
}