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

34 lines
832 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { motion } from 'framer-motion';
import { animateDropdownItem } from '@/styling/animations';
2023-09-02 01:11:27 +03:00
import Checkbox from './Checkbox';
interface DropdownCheckboxProps {
2023-12-28 14:04:44 +03:00
value: boolean;
label?: string;
title?: string;
disabled?: boolean;
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 (
2023-12-28 14:04:44 +03:00
<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
}
2023-12-28 14:04:44 +03:00
export default DropdownCheckbox;