import React, { useState } from 'react'; import { SessionIcon, SessionIconType } from './icon/'; import { SessionDropdownItem, SessionDropDownItemType } from './SessionDropdownItem'; // THIS IS DROPDOWN ACCORDIAN STYLE OPTIONS SELECTOR ELEMENT, NOT A CONTEXTMENU type Props = { label: string; onClick?: any; expanded?: boolean; options: Array<{ content: string; id?: string; icon?: SessionIconType | null; type?: SessionDropDownItemType; active?: boolean; onClick?: any; }>; }; export const SessionDropdown = (props: Props) => { const { label, options } = props; const [expanded, setExpanded] = useState(!!props.expanded); const chevronOrientation = expanded ? 180 : 0; return (
{ setExpanded(!expanded); }} role="button" > {label}
{expanded && (
{options.map((item: any) => { return ( { setExpanded(false); item.onClick(); }} /> ); })}
)}
); };