gitscope
← marzneshin / v0.4.0 / dashboard/src/features/hosts/dialogs/mutation/fields/is-disabled.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/hosts/dialogs/mutation/fields/is-disabled.tsx · TypeScript
Blame Raw
 1import { Switch, FormField, FormControl, FormItem } from "@marzneshin/components";
 2import { useFormContext } from "react-hook-form";
 3
 4export const IsDisabled = () => {
 5    const form = useFormContext();
 6    return (
 7        <FormField
 8            control={form.control}
 9            name="is_disabled"
10            render={({ field }) => (
11                <FormItem>
12                    <FormControl>
13                        <Switch
14                            checked={!field.value}
15                            onCheckedChange={(checked) => field.onChange(!checked)}
16                        />
17                    </FormControl>
18                </FormItem>
19            )}
20        />
21    )
22}