2022-06-05 18:56:42 +00:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import styles from '@/components/elements/dropdown/style.module.css';
|
|
|
|
import { ChevronDownIcon } from '@heroicons/react/solid';
|
|
|
|
import { Menu } from '@headlessui/react';
|
2022-11-25 20:25:03 +00:00
|
|
|
import * as React from 'react';
|
2022-06-05 18:56:42 +00:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
className?: string;
|
|
|
|
animate?: boolean;
|
|
|
|
children: React.ReactNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ({ className, animate = true, children }: Props) => (
|
|
|
|
<Menu.Button className={classNames(styles.button, className || 'px-4')}>
|
2022-06-26 19:13:52 +00:00
|
|
|
{typeof children === 'string' ? (
|
2022-06-05 18:56:42 +00:00
|
|
|
<>
|
|
|
|
<span className={'mr-2'}>{children}</span>
|
2022-06-26 19:13:52 +00:00
|
|
|
<ChevronDownIcon aria-hidden={'true'} data-animated={animate.toString()} />
|
2022-06-05 18:56:42 +00:00
|
|
|
</>
|
2022-06-26 19:13:52 +00:00
|
|
|
) : (
|
2022-06-05 18:56:42 +00:00
|
|
|
children
|
2022-06-26 19:13:52 +00:00
|
|
|
)}
|
2022-06-05 18:56:42 +00:00
|
|
|
</Menu.Button>
|
|
|
|
);
|