mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor: autoRemount as boolean
This commit is contained in:
25
apps/client/app/components/onoff.tsx
Normal file
25
apps/client/app/components/onoff.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { cn } from "~/lib/utils";
|
||||
import { Switch } from "./ui/switch";
|
||||
|
||||
type Props = {
|
||||
isOn: boolean;
|
||||
toggle: (v: boolean) => void;
|
||||
enabledLabel: string;
|
||||
disabledLabel: string;
|
||||
};
|
||||
|
||||
export const OnOff = ({ isOn, toggle, enabledLabel, disabledLabel }: Props) => {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs font-semibold uppercase tracking-wide transition-colors",
|
||||
isOn
|
||||
? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-200"
|
||||
: "border-muted bg-muted/40 text-muted-foreground dark:border-muted/60 dark:bg-muted/10",
|
||||
)}
|
||||
>
|
||||
<span>{isOn ? enabledLabel : disabledLabel}</span>
|
||||
<Switch checked={isOn} onCheckedChange={toggle} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user