diff --git a/src/components/Switch.tsx b/src/components/Switch.tsx index 973da62..4dafc89 100644 --- a/src/components/Switch.tsx +++ b/src/components/Switch.tsx @@ -1,15 +1,16 @@ import cx from 'clsx'; -import { isEqual } from 'lodash-es'; +import { isEqual, isNil } from 'lodash-es'; import { useCallback, useEffect, useState } from 'react'; import styles from './Switch.module.css'; type SwitchProps = { + name?: string; checked?: boolean; disabled?: boolean; onChange?: (checked: boolean) => void; }; -export function Switch({ checked = false, disabled = false, onChange }: SwitchProps) { +export function Switch({ name, checked = false, disabled = false, onChange }: SwitchProps) { const [isChecked, setIsChecked] = useState(checked); const handleSwitch = useCallback(() => { if (!disabled) { @@ -29,6 +30,7 @@ export function Switch({ checked = false, disabled = false, onChange }: SwitchPr
+ {!isNil(name) && } ); }