import { h } from 'preact'; import { useRef, useState } from 'preact/hooks'; import Menu from './Menu'; import { ArrowDropdown } from '../icons/ArrowDropdown'; import Heading from './Heading'; import Button from './Button'; import CameraIcon from '../icons/Camera'; export default function MultiSelect({ className, title, options, selection, onToggle, onShowAll, onSelectSingle }) { const popupRef = useRef(null); const [state, setState] = useState({ showMenu: false, }); const isOptionSelected = (item) => { return selection == "all" || selection.split(',').indexOf(item) > -1; } const menuHeight = Math.round(window.innerHeight * 0.55); return (
setState({ showMenu: true })} >
{state.showMenu ? ( setState({ showMenu: false })}>
{title}
{options.map((item) => (
))}
): null}
); }