index.tsx 594 B

12345678910111213141516171819202122232425262728293031
  1. import s from './index.module.css'
  2. import cn from '@/utils/classnames'
  3. type CheckboxProps = {
  4. checked?: boolean
  5. onCheck?: () => void
  6. className?: string
  7. disabled?: boolean
  8. }
  9. const Checkbox = ({ checked, onCheck, className, disabled }: CheckboxProps) => {
  10. return (
  11. <div
  12. className={cn(
  13. s.wrapper,
  14. checked && s.checked,
  15. disabled && s.disabled,
  16. 'w-4 h-4 border rounded border-gray-300',
  17. className,
  18. )}
  19. onClick={() => {
  20. if (disabled)
  21. return
  22. onCheck?.()
  23. }}
  24. />
  25. )
  26. }
  27. export default Checkbox