diff --git a/app/components/Dropdown.tsx b/app/components/Dropdown.tsx new file mode 100644 index 0000000..5cd2ca6 --- /dev/null +++ b/app/components/Dropdown.tsx @@ -0,0 +1,84 @@ +import { Menu, type MenuButtonProps, Transition } from '@headlessui/react' +import clsx from 'clsx' +import { Fragment, type HTMLProps, type ReactNode } from 'react' + +type Properties = { + readonly children: ReactNode; + readonly button: ReactNode; + // eslint-disable-next-line unicorn/no-keyword-prefix + readonly className?: string; +} + +function Dropdown(properties: Properties) { + return ( +
+ + + + + {properties.children} + + + +
+ ) +} + +function Button(properties: MenuButtonProps<'button'>) { + return ( + + {properties.children} + + ) +} + +type ItemProperties = HTMLProps & { + variant?: 'static' | 'normal'; +} + +function Item(properties: ItemProperties) { + return ( + + {({ active }) => ( +
+ {properties.children} +
+ )} +
+ ) +} + +export default Object.assign(Dropdown, { Item }) diff --git a/app/routes/_data.tsx b/app/routes/_data.tsx index e7b56f5..cb98ab7 100644 --- a/app/routes/_data.tsx +++ b/app/routes/_data.tsx @@ -1,10 +1,8 @@ -import { Menu, Transition } from '@headlessui/react' import { Cog8ToothIcon, CpuChipIcon, GlobeAltIcon, LockClosedIcon, ServerStackIcon, UserCircleIcon, UsersIcon } from '@heroicons/react/24/outline' import { type LoaderFunctionArgs, redirect } from '@remix-run/node' import { Form, Outlet, useLoaderData, useRouteError } from '@remix-run/react' -import clsx from 'clsx' -import { Fragment } from 'react/jsx-runtime' +import Dropdown from '~/components/Dropdown' import { ErrorPopup } from '~/components/Error' import TabLink from '~/components/TabLink' import { getContext } from '~/utils/config' @@ -64,56 +62,21 @@ export default function Layout() { Headscale -
- - - - - - - - {() => ( -
-

{data.user?.name}

-

{data.user?.email}

-
- )} -
- - {({ active }) => ( -
- -
- )} -
-
-
-
-
+ } + > + +

{data.user?.name}

+

{data.user?.email}

+
+ +
+ +
+
+