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

29 lines
678 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`}
2023-09-02 01:11:27 +03:00
>
<Checkbox
dimensions='w-full'
2023-09-02 01:11:27 +03:00
disabled={disabled}
2023-09-07 16:30:43 +03:00
setValue={setValue}
{...restProps}
2023-09-02 01:11:27 +03:00
/>
</div>
);
}
export default DropdownCheckbox;