Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | import { InfoRounded } from "@mui/icons-material"; import { Tooltip } from "@mui/material"; import React from "react"; interface CheckboxProps { id: string; label: string; help?: string; isChecked: boolean; isSmall?: boolean; info?: string; onChange: (id: string) => void; disabled?: boolean; } const Checkbox: React.FC<CheckboxProps> = ({ id, label, help, isChecked, onChange, isSmall = false, info, disabled = false, }) => { return ( <div className="flex flex-col gap-2"> <div className="flex items-center"> <label className={`inline-flex items-center cursor-pointer ${ isSmall ? "gap-1" : "gap-2" } `}> <input type="checkbox" className="sr-only" checked={isChecked} disabled={disabled} onChange={() => onChange(id)} /> <div className={`${isSmall ? "w-4 h-4" : "w-5 h-5"} ${ disabled ? "bg-gray-200" : "" } inline-block rounded border transition duration-300 ease-in-out ${ isChecked ? "bg-violet-500 border-violet-500" : "border-gray-300" }`}> {isChecked && ( <svg className="text-white w-full h-full transition-transform transform-gpu duration-300 ease-in-out" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="3" d="M5 13l4 4L19 7" /> </svg> )} </div> <span className={`${isSmall ? "text-sm" : "text-base"} ${ disabled ? "text-gray-300" : "" } text-gray-700 transition duration-300 ease-in-out`}> {label} </span> {info && ( <Tooltip title={info}> <InfoRounded color="primary" /> </Tooltip> )} </label> </div> {help && <span className="text-sm text-[#ADADAD]">{help}</span>} </div> ); }; export default Checkbox; |