File size: 939 Bytes
56b6519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 { Checkbox } from '@headlessui/react';
import { CheckIcon } from '@heroicons/react/16/solid';

export type CheckboxButtonProps = {
  text: string;
  checked: boolean;
  onChange: React.Dispatch<React.SetStateAction<boolean>>;
};

const CheckboxButton = ({ text, checked, onChange }: CheckboxButtonProps) => {
  const handleCheckboxChange = (value: boolean) => {
    onChange(value);
  };

  return (
    <div className="flex items-center">
      <Checkbox
        checked={checked}
        className="group flex items-center justify-center size-6 rounded-md bg-white/10 p-1 ring-1 ring-white/15 ring-inset data-[checked]:bg-white"
        onChange={handleCheckboxChange}
      >
        <CheckIcon className="hidden size-4 fill-black group-data-[checked]:block" />
      </Checkbox>
      <div className="ml-2">
        <p className="text-md text-gray-200">{text}</p>
      </div>
    </div>
  );
};

export default CheckboxButton;