react-icons/md#MdExpandMore TypeScript Examples
The following examples show how to use
react-icons/md#MdExpandMore.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DropdownFilter.tsx From po8klasie with GNU General Public License v3.0 | 5 votes |
DropdownFilter: FC<DropdownFilterProps> = ({
onChange,
value,
options: { title, choices, isMultipleChoice },
}) => {
const { selected, selectItem } = useSelected(value as [], !!isMultipleChoice);
const isDropdownActive = selected.length > 0;
/* TODO(micorix): add keyboard listener and proper ARIA */
/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions */
return (
<div className={styles.dropdownWrapper} onMouseLeave={() => onChange(selected)}>
<button
type="button"
className={isDropdownActive ? styles.dropdownButtonActive : styles.dropdownButton}
>
{title}
<MdExpandMore />
<span className={styles.dropdownSpace} />
</button>
<div className={styles.dropdownListWrapper}>
<PerfectScrollbar>
<ul className={styles.dropdownList}>
{choices.map((choice: DropdownChoice) => (
<li
className={
selected.includes(choice.value)
? styles.dropdownListItemActive
: styles.dropdownListItem
}
onClick={() => selectItem(choice.value)}
key={choice.value}
>
{choice.label} <MdCheck />
</li>
))}
</ul>
</PerfectScrollbar>
</div>
</div>
);
}
Example #2
Source File: DropdownFilter.tsx From po8klasie with GNU General Public License v3.0 | 5 votes |
MobileDropdownFilter: FC<DropdownFilterProps> = ({
onChange,
value,
options: { title, choices, isMultipleChoice },
}) => {
const { selected, selectItem } = useSelected(value as [], !!isMultipleChoice);
useEffect(() => {
onChange(selected);
}, [selected])
return (
<div className="border-b border-light">
<Disclosure>
{({ open }) => (
<>
<Disclosure.Button className="flex w-full justify-between px-2 py-2">
<span>{title}</span>
<MdExpandMore className={`text-2xl text-primary transition transform ${open ? 'rotate-180' : ''}`} />
</Disclosure.Button>
<Disclosure.Panel className="px-2">
<ul className="">
{choices.map((choice: DropdownChoice) => (
<li
className={
`rounded-lg bg-opacity-50 my-2 px-2 py-2 flex items-center border-2 border-light transition
${ selected.includes(choice.value) ? 'bg-light' : ''}`
}
onClick={() => selectItem(choice.value)}
key={choice.value}
>
<MdCheck className={
`mr-2 transition text-primary ${selected.includes(choice.value) ? 'opacity-100' : 'opacity-0'}`
} /> {choice.label}
</li>
))}
</ul>
</Disclosure.Panel>
</>
)}
</Disclosure>
</div>
)
}