(props: {
title: string;
items: SelectBoxWithDropdownOption[];
})
| 11 | } |
| 12 | |
| 13 | export default function SelectBoxOptionDropdownWithCheckboxes(props: { |
| 14 | title: string; |
| 15 | items: SelectBoxWithDropdownOption[]; |
| 16 | }) { |
| 17 | return ( |
| 18 | <Menu as="div" className="relative inline-block text-left shrink-0"> |
| 19 | <div> |
| 20 | <Menu.Button className="inline-flex w-full justify-center gap-x-1.5 rounded-md bg-gray-850 px-3 py-1.5 text-xs md:text-sm font-medium text-gray-300 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-900"> |
| 21 | {props.title} |
| 22 | <ChevronDownIcon |
| 23 | className="-mr-1 w-4 h-4 md:w-5 md:h-5 text-gray-400" |
| 24 | aria-hidden="true" |
| 25 | /> |
| 26 | </Menu.Button> |
| 27 | </div> |
| 28 | |
| 29 | <Transition |
| 30 | as={Fragment} |
| 31 | enter="transition ease-out duration-100" |
| 32 | enterFrom="transform opacity-0 scale-95" |
| 33 | enterTo="transform opacity-100 scale-100" |
| 34 | leave="transition ease-in duration-75" |
| 35 | leaveFrom="transform opacity-100 scale-100" |
| 36 | leaveTo="transform opacity-0 scale-95" |
| 37 | > |
| 38 | <Menu.Items |
| 39 | static |
| 40 | className="absolute right-0 z-10 mt-2 w-40 origin-top-right rounded-md bg-gray-850 shadow-lg ring-1 ring-black border border-gray-600 ring-opacity-5 focus:outline-none" |
| 41 | > |
| 42 | <div className="py-1 divide-y divide-gray-800"> |
| 43 | {props.items.map((item) => ( |
| 44 | <Menu.Item key={item.id}> |
| 45 | <div |
| 46 | className="select-none cursor-pointer hover:bg-gray-900 hover:text-gray-50 text-gray-200 px-4 py-2 text-sm flex flex-row place-items-center gap-x-4" |
| 47 | onClick={(e) => { |
| 48 | e.preventDefault(); |
| 49 | item.onChange(!item.checked); |
| 50 | }} |
| 51 | > |
| 52 | <Checkbox |
| 53 | onChange={item.onChange} |
| 54 | checked={item.checked} |
| 55 | label={""} |
| 56 | /> |
| 57 | {item.name} |
| 58 | </div> |
| 59 | </Menu.Item> |
| 60 | ))} |
| 61 | </div> |
| 62 | </Menu.Items> |
| 63 | </Transition> |
| 64 | </Menu> |
| 65 | ); |
| 66 | } |
nothing calls this directly
no outgoing calls
no test coverage detected