overleaf-cep/services/web/frontend/js/shared/components/switch.tsx
Andrew Rumble 519b18e4a1 Lint fixes
GitOrigin-RevId: 686f3fb718faf5830a34656d45f888c8e245f7f9
2025-07-09 08:05:48 +00:00

27 lines
631 B
TypeScript

import classNames from 'classnames'
type SwitchProps = {
onChange: () => void
checked: boolean
disabled?: boolean
}
function Switch({ onChange, checked, disabled = false }: SwitchProps) {
return (
// eslint-disable-next-line jsx-a11y/label-has-associated-control
<label className={classNames('switch-input', { disabled })}>
<input
className="invisible-input"
type="checkbox"
role="switch"
autoComplete="off"
onChange={onChange}
checked={checked}
disabled={disabled}
/>
<span className="switch" />
</label>
)
}
export default Switch