diff --git a/package.json b/package.json index 8b9c0df4..3ed8fdff 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "sharp": "0.32.0", "sortablejs": "1.15.0", "tailwind-merge": "^1.12.0", + "tailwind-scrollbar-hide": "^1.1.7", "tailwindcss-animate": "^1.0.5", "unidata.js": "0.7.18", "unified": "10.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f50f8ba..bf025af7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -253,6 +253,9 @@ dependencies: tailwind-merge: specifier: ^1.12.0 version: 1.12.0 + tailwind-scrollbar-hide: + specifier: ^1.1.7 + version: 1.1.7 tailwindcss-animate: specifier: ^1.0.5 version: 1.0.5(tailwindcss@3.3.1) @@ -12080,6 +12083,10 @@ packages: resolution: {integrity: sha512-Y17eDp7FtN1+JJ4OY0Bqv9OA41O+MS8c1Iyr3T6JFLnOgLg3EvcyMKZAnQ8AGyvB5Nxm3t9Xb5Mhe139m8QT/g==} dev: false + /tailwind-scrollbar-hide@1.1.7: + resolution: {integrity: sha512-X324n9OtpTmOMqEgDUEA/RgLrNfBF/jwJdctaPZDzB3mppxJk7TLIDmOreEDm1Bq4R9LSPu4Epf8VSdovNU+iA==} + dev: false + /tailwindcss-animate@1.0.5(tailwindcss@3.3.1): resolution: {integrity: sha512-UU3qrOJ4lFQABY+MVADmBm+0KW3xZyhMdRvejwtXqYOL7YjHYxmuREFAZdmVG5LPe5E9CAst846SLC4j5I3dcw==} peerDependencies: diff --git a/src/components/dashboard/DashboardLayout.tsx b/src/components/dashboard/DashboardLayout.tsx index 3b3a5b86..4f36dc0e 100644 --- a/src/components/dashboard/DashboardLayout.tsx +++ b/src/components/dashboard/DashboardLayout.tsx @@ -1,6 +1,6 @@ import { cn } from "~/lib/utils" import { useRouter } from "next/router" -import React, { useEffect } from "react" +import React, { useEffect, useState } from "react" import { DISCORD_LINK, APP_NAME } from "~/lib/env" import { getSiteLink } from "~/lib/helpers" @@ -22,6 +22,8 @@ import { useTranslation } from "react-i18next" import { Logo } from "~/components/common/Logo" import { getStorage } from "~/lib/storage" import { useGetPagesBySite } from "~/queries/page" +import { DashboardTopbar } from "./DashboardTopbar" +import { useMobileLayout } from "~/hooks/useMobileLayout" export function DashboardLayout({ children, @@ -45,6 +47,8 @@ export function DashboardLayout({ const [hasPermission, setHasPermission] = React.useState(false) const { t } = useTranslation("dashboard") + const isMobileLayout = useMobileLayout() + useEffect(() => { if (ssrReady) { if (!isConnected) { @@ -169,102 +173,185 @@ export function DashboardLayout({ /> )}
{t(title)}
} diff --git a/src/components/dashboard/DashboardTopbar.tsx b/src/components/dashboard/DashboardTopbar.tsx new file mode 100644 index 00000000..1fecffe4 --- /dev/null +++ b/src/components/dashboard/DashboardTopbar.tsx @@ -0,0 +1,70 @@ +import { useState, useEffect, useMemo, Fragment } from "react" +import { setStorage, getStorage } from "~/lib/storage" + +import { Bars3Icon, ChevronDownIcon } from "@heroicons/react/24/outline" +import { Logo } from "../common/Logo" +import { Popover, Transition } from "@headlessui/react" + +export const DashboardTopbar: React.FC<{ + children: (open: boolean) => React.ReactNode + userWidget: React.ReactNode + drawerWidget: (close: any) => React.ReactNode +}> = ({ children, userWidget, drawerWidget }) => { + const [isOpen, setIsOpen] = useState(false) + + return ( +