mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-16 08:05:22 +03:00
add ToggleButton component
This commit is contained in:
parent
8be2851a5a
commit
6ca7b9885c
29
web/src/components/ui/toggle-button.tsx
Normal file
29
web/src/components/ui/toggle-button.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user