ConceptPortal-public/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx
2023-09-07 16:30:43 +03:00

29 lines
670 B
TypeScript

import Checkbox from './Checkbox';
interface DropdownCheckboxProps {
value: boolean
label?: string
tooltip?: string
disabled?: boolean
setValue?: (newValue: boolean) => void
}
function DropdownCheckbox({ tooltip, setValue, disabled, ...props }: DropdownCheckboxProps) {
const behavior = (setValue && !disabled ? 'clr-hover' : '');
return (
<div
title={tooltip}
className={`px-4 py-1 text-left overflow-ellipsis ${behavior} w-full whitespace-nowrap`}
>
<Checkbox
widthClass='w-full'
disabled={disabled}
setValue={setValue}
{...props}
/>
</div>
);
}
export default DropdownCheckbox;