mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 13:46:34 -05:00
27 lines
561 B
TypeScript
27 lines
561 B
TypeScript
|
import classNames from 'classnames'
|
||
|
|
||
|
type SwitchProps = {
|
||
|
onChange: () => void
|
||
|
checked: boolean
|
||
|
disabled?: boolean
|
||
|
}
|
||
|
|
||
|
function Switch({ onChange, checked, disabled = false }: SwitchProps) {
|
||
|
return (
|
||
|
<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
|