import { useState } from "react"; import { Metrics } from "@components/Drawer/Metrics.js"; import { Notifications } from "@components/Drawer/Notifications.js"; import { Sensor } from "@components/Drawer/Sensor.js"; import type { TabType } from "@components/generic/TabbedContent.js"; import { Tab } from "@headlessui/react"; import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline"; export const Drawer = (): JSX.Element => { const [drawerOpen, setDrawerOpen] = useState(false); const tabs: TabType[] = [ { name: "Notifications", element: Notifications }, { name: "Metrics", element: Metrics }, { name: "Sensor", element: Sensor } ]; return ( {tabs.map((tab, index) => ( {({ selected }) => (
{ setDrawerOpen(true); }} className={`flex h-full cursor-pointer border-b-4 px-1 first:pl-2 last:pr-2 hover:text-textPrimary ${ selected ? "border-accent text-textPrimary" : "border-backgroundPrimary text-textSecondary" }`} > {tab.name}
)}
))}
{ setDrawerOpen(!drawerOpen); }} className="flex cursor-pointer px-2" >
{drawerOpen ? ( ) : ( )}
{tabs.map((tab, index) => ( {tab.element} ))}
); };