File size: 594 Bytes
a8b3f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import s from './index.module.css'
import cn from '@/utils/classnames'

type CheckboxProps = {
  checked?: boolean
  onCheck?: () => void
  className?: string
  disabled?: boolean
}

const Checkbox = ({ checked, onCheck, className, disabled }: CheckboxProps) => {
  return (
    <div
      className={cn(
        s.wrapper,
        checked && s.checked,
        disabled && s.disabled,
        'w-4 h-4 border rounded border-gray-300',
        className,
      )}
      onClick={() => {
        if (disabled)
          return

        onCheck?.()
      }}
    />
  )
}

export default Checkbox