diff --git a/src/components/layout/header/internal/HeaderDrawerButton.tsx b/src/components/layout/header/internal/HeaderDrawerButton.tsx index 456e8fa63a..26b44f989b 100644 --- a/src/components/layout/header/internal/HeaderDrawerButton.tsx +++ b/src/components/layout/header/internal/HeaderDrawerButton.tsx @@ -1,21 +1,17 @@ 'use client' import * as Dialog from '@radix-ui/react-dialog' -import { memo } from 'react' import { AnimatePresence, motion } from 'framer-motion' import { atom, useAtom } from 'jotai' -import Link from 'next/link' import type { SVGProps } from 'react' import { CloseIcon } from '~/components/icons/close' import { MotionButtonBase } from '~/components/ui/button' import { DialogOverlay } from '~/components/ui/dlalog/DialogOverlay' -import { reboundPreset } from '~/constants/spring' import { useIsClient } from '~/hooks/common/use-is-client' -import { jotaiStore } from '~/lib/store' import { HeaderActionButton } from './HeaderActionButton' -import { useHeaderConfig } from './HeaderDataConfigureProvider' +import { HeaderDrawerContent } from './HeaderDrawerContent' function IcBaselineMenuOpen(props: SVGProps) { return ( @@ -28,7 +24,7 @@ function IcBaselineMenuOpen(props: SVGProps) { ) } -const drawerOpenAtom = atom(false) +export const drawerOpenAtom = atom(false) export const HeaderDrawerButton = () => { const [open, setOpen] = useAtom(drawerOpenAtom) @@ -52,7 +48,7 @@ export const HeaderDrawerButton = () => { { ) } - -// @ts-ignore -const LinkInternal: typeof Link = memo(function LinkInternal({ - children, - ...rest -}) { - return ( - { - jotaiStore.set(drawerOpenAtom, false) - }} - > - {children} - - ) -}) - -const HeaderDrawerContent = () => { - const { config } = useHeaderConfig() - - return ( -
- {config.map((section, index) => { - return ( - - - - {section.icon} -

{section.title}

-
-
- - {section.subMenu && ( -
    - {section.subMenu.map((sub) => { - return ( -
  • - - {sub.title} - -
  • - ) - })} -
- )} -
- ) - })} -
- ) -} diff --git a/src/components/layout/header/internal/HeaderDrawerContent.tsx b/src/components/layout/header/internal/HeaderDrawerContent.tsx new file mode 100644 index 0000000000..19e32493f8 --- /dev/null +++ b/src/components/layout/header/internal/HeaderDrawerContent.tsx @@ -0,0 +1,75 @@ +'use client' + +import { memo } from 'react' +import { motion } from 'framer-motion' +import Link from 'next/link' + +import { reboundPreset } from '~/constants/spring' +import { jotaiStore } from '~/lib/store' + +import { useHeaderConfig } from './HeaderDataConfigureProvider' +import { drawerOpenAtom } from './HeaderDrawerButton' + +export const HeaderDrawerContent = () => { + const { config } = useHeaderConfig() + + return ( +
+ {config.map((section, index) => { + return ( + + + + {section.icon} +

{section.title}

+
+
+ + {section.subMenu && ( +
    + {section.subMenu.map((sub) => { + return ( +
  • + + {sub.title} + +
  • + ) + })} +
+ )} +
+ ) + })} +
+ ) +} +// @ts-ignore +const LinkInternal: typeof Link = memo(function LinkInternal({ + children, + ...rest +}) { + return ( + { + jotaiStore.set(drawerOpenAtom, false) + }} + > + {children} + + ) +})