chore: fix lint errors
This commit is contained in:
@@ -6,7 +6,16 @@ type ToggleSwitchProps = {
|
||||
onChange?: (checked: boolean) => void;
|
||||
};
|
||||
|
||||
const SwitchButton: React.FC<ToggleSwitchProps> = ({ isChecked = true, onChange }) => {
|
||||
/**
|
||||
* A custom switch button component.
|
||||
*
|
||||
* @component
|
||||
* @param {Object} props - The component props.
|
||||
* @param {boolean} [props.isChecked=true] - The initial checked state of the switch button.
|
||||
* @param {Function} props.onChange - The callback function to be called when the switch button is toggled.
|
||||
* @returns {JSX.Element} The rendered SwitchButton component.
|
||||
*/
|
||||
const SwitchButton = ({ isChecked = true, onChange }: ToggleSwitchProps): JSX.Element => {
|
||||
const [enabled, setEnabled] = useState(isChecked);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -16,7 +25,7 @@ const SwitchButton: React.FC<ToggleSwitchProps> = ({ isChecked = true, onChange
|
||||
const handleChange = (checked: boolean) => {
|
||||
setEnabled(checked);
|
||||
if (onChange) {
|
||||
onChange;
|
||||
onChange(checked);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user