import useOutsideClickRef from '@rooks/use-outside-click-ref'; import cx from 'classnames'; import React, { useCallback, useMemo, useState } from 'react'; import * as S from './Dropdown.styled'; export interface DropdownProps { label: React.ReactNode; right?: boolean; up?: boolean; } const Dropdown: React.FC = ({ label, right, up, children }) => { const [active, setActive] = useState(false); const [wrapperRef] = useOutsideClickRef(() => setActive(false)); const onClick = useCallback(() => setActive(!active), [active]); const classNames = useMemo( () => cx('dropdown', { 'is-active': active, 'is-right': right, 'is-up': up, }), [active, right, up] ); return (
{label}
); }; export default Dropdown;