From 4f2a29f2685482b7d033093621b57cee4c3d2b70 Mon Sep 17 00:00:00 2001 From: doprz <52579214+doprz@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:31:17 -0500 Subject: [PATCH] chore: fix lint errors --- src/views/components/common/SwitchButton.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/views/components/common/SwitchButton.tsx b/src/views/components/common/SwitchButton.tsx index 5252e092..ab8b4d16 100644 --- a/src/views/components/common/SwitchButton.tsx +++ b/src/views/components/common/SwitchButton.tsx @@ -6,7 +6,16 @@ type ToggleSwitchProps = { onChange?: (checked: boolean) => void; }; -const SwitchButton: React.FC = ({ 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 = ({ isChecked = true, onChange const handleChange = (checked: boolean) => { setEnabled(checked); if (onChange) { - onChange; + onChange(checked); } }; @@ -24,11 +33,11 @@ const SwitchButton: React.FC = ({ isChecked = true, onChange