refactor(web): remove typescript
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import FormControlLabel, {
|
||||
FormControlLabelProps,
|
||||
} from '@mui/material/FormControlLabel';
|
||||
import MuiSwitch, { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';
|
||||
|
||||
type SwitchProps = {
|
||||
name: string;
|
||||
label: string;
|
||||
shouldUnregister?: boolean;
|
||||
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
||||
} & MuiSwitchProps;
|
||||
|
||||
export default function Switch(props: SwitchProps): React.ReactElement {
|
||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||
import MuiSwitch from '@mui/material/Switch';
|
||||
export default function Switch(props) {
|
||||
const { control } = useFormContext();
|
||||
const inputRef = React.useRef<HTMLInputElement | null>(null);
|
||||
const inputRef = React.useRef(null);
|
||||
const {
|
||||
required,
|
||||
name,
|
||||
@@ -28,7 +18,6 @@ export default function Switch(props: SwitchProps): React.ReactElement {
|
||||
className,
|
||||
...switchProps
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<Controller
|
||||
rules={{ required }}
|
Reference in New Issue
Block a user