Files
squoosh/src/components/checkbox/index.tsx
2020-08-12 18:14:16 -04:00

21 lines
599 B
TypeScript

import { h, Component } from 'preact';
import * as style from './style.module.scss';
import { UncheckedIcon, CheckedIcon } from '../../lib/icons';
interface Props extends JSX.HTMLAttributes {}
interface State {}
export default class Checkbox extends Component<Props, State> {
render(props: Props) {
return (
<div class={style.checkbox}>
{props.checked
? <CheckedIcon class={`${style.icon} ${style.checked}`} />
: <UncheckedIcon class={style.icon} />
}
<input class={style.realCheckbox} type="checkbox" {...props}/>
</div>
);
}
}