ConceptPortal-public/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx

28 lines
653 B
TypeScript
Raw Normal View History

2023-09-02 01:11:27 +03:00
import Checkbox from './Checkbox';
interface DropdownCheckboxProps {
2023-09-07 16:30:43 +03:00
value: boolean
2023-09-02 01:11:27 +03:00
label?: string
tooltip?: string
disabled?: boolean
2023-09-07 16:30:43 +03:00
setValue?: (newValue: boolean) => void
2023-09-02 01:11:27 +03:00
}
function DropdownCheckbox({ tooltip, setValue, disabled, ...restProps }: DropdownCheckboxProps) {
const behavior = (setValue && !disabled) ? 'clr-hover' : '';
2023-09-02 01:11:27 +03:00
return (
<div
title={tooltip}
className={`px-4 py-1 text-left overflow-ellipsis ${behavior} w-full whitespace-nowrap`}
>
<Checkbox
dimensions='w-full'
disabled={disabled}
setValue={setValue}
{...restProps}
/>
</div>);
2023-09-02 01:11:27 +03:00
}
export default DropdownCheckbox;