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

36 lines
820 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { motion } from 'framer-motion';
import { animateDropdownItem } from '@/utils/animations';
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
title?: string
2023-09-02 01:11:27 +03:00
disabled?: boolean
2023-09-07 16:30:43 +03:00
setValue?: (newValue: boolean) => void
2023-09-02 01:11:27 +03:00
}
function DropdownCheckbox({ title, setValue, disabled, ...restProps }: DropdownCheckboxProps) {
2023-09-02 01:11:27 +03:00
return (
<motion.div
variants={animateDropdownItem}
title={title}
className={clsx(
'px-3 py-1',
'text-left overflow-ellipsis whitespace-nowrap',
'disabled:clr-text-controls',
!!setValue && !disabled && 'clr-hover'
)}
>
<Checkbox
disabled={disabled}
setValue={setValue}
{...restProps}
/>
</motion.div>);
2023-09-02 01:11:27 +03:00
}
export default DropdownCheckbox;