2023-09-13 14:10:35 +00:00
|
|
|
import { Fragment } from "react";
|
2023-09-25 07:54:23 +00:00
|
|
|
|
2023-09-13 14:10:35 +00:00
|
|
|
// headless ui
|
|
|
|
import { Popover, Transition } from "@headlessui/react";
|
2023-09-25 07:54:23 +00:00
|
|
|
// icons
|
|
|
|
import { ChevronUp } from "lucide-react";
|
2023-09-13 14:10:35 +00:00
|
|
|
|
|
|
|
interface IIssueDropdown {
|
|
|
|
children: React.ReactNode;
|
|
|
|
title?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const IssueDropdown = ({ children, title = "Dropdown" }: IIssueDropdown) => (
|
|
|
|
<Popover className="relative">
|
|
|
|
{({ open }) => {
|
|
|
|
if (open) {
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Popover.Button
|
2023-09-25 07:54:23 +00:00
|
|
|
className={`outline-none border border-custom-border-200 text-xs rounded flex items-center gap-2 px-2 py-1.5 hover:bg-custom-background-80 ${
|
|
|
|
open ? "text-custom-text-100" : "text-custom-text-200"
|
|
|
|
}`}
|
2023-09-13 14:10:35 +00:00
|
|
|
>
|
|
|
|
<div className="font-medium">{title}</div>
|
2023-09-25 07:54:23 +00:00
|
|
|
<div className={`w-3.5 h-3.5 flex items-center justify-center transition-all ${open ? "" : "rotate-180"}`}>
|
|
|
|
<ChevronUp width={14} strokeWidth={2} />
|
2023-09-13 14:10:35 +00:00
|
|
|
</div>
|
|
|
|
</Popover.Button>
|
|
|
|
<Transition
|
|
|
|
as={Fragment}
|
|
|
|
enter="transition ease-out duration-200"
|
|
|
|
enterFrom="opacity-0 translate-y-1"
|
|
|
|
enterTo="opacity-100 translate-y-0"
|
|
|
|
leave="transition ease-in duration-150"
|
|
|
|
leaveFrom="opacity-100 translate-y-0"
|
|
|
|
leaveTo="opacity-0 translate-y-1"
|
|
|
|
>
|
2023-09-25 13:47:40 +00:00
|
|
|
<Popover.Panel className="absolute right-0 z-10 mt-1 bg-custom-background-100 border border-custom-border-200 shadow-custom-shadow-rg rounded overflow-hidden">
|
|
|
|
<div className="w-[18.75rem] max-h-[37.5rem] flex flex-col overflow-hidden">{children}</div>
|
2023-09-13 14:10:35 +00:00
|
|
|
</Popover.Panel>
|
|
|
|
</Transition>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</Popover>
|
|
|
|
);
|