chore: fix lint errors

This commit is contained in:
doprz
2024-09-30 19:31:17 -05:00
parent d5c3d32170
commit 4f2a29f268

View File

@@ -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);
}
};