diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index f09c0c25..af19e043 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -49,7 +49,7 @@ export const App: React.FC = ({ showAuthor = false, menu, ...props }) header={(
{hideBreadcrumbs || !props.breadcrumbs ? null : ( diff --git a/src/components/Navigation/DesktopNavigation.tsx b/src/components/Navigation/DesktopNavigation.tsx new file mode 100644 index 00000000..a478def5 --- /dev/null +++ b/src/components/Navigation/DesktopNavigation.tsx @@ -0,0 +1,30 @@ +import { Menu } from "../Menu" +import { useContext } from "react" +import { ConfigContext } from "src/context/ConfigContext" +import { Box } from "@/ui/Box" +import { HudozkaLogo } from "../HudozkaLogo" +import { useDarkTheme } from "@/hooks/useDarkTheme" +import Link from "next/link" + +export type DesktopNavigationProps = { + style?: React.CSSProperties +} + +export const DesktopNavigation: React.FC = ({ style }) => { + const dark = useDarkTheme() + const { menu } = useContext(ConfigContext) + + return ( + + + + + + + + + + ) +} diff --git a/src/components/Navigation/MobileNavigation.tsx b/src/components/Navigation/MobileNavigation.tsx new file mode 100644 index 00000000..f4e63e92 --- /dev/null +++ b/src/components/Navigation/MobileNavigation.tsx @@ -0,0 +1,64 @@ +import { MenuToggle } from "../MenuToggle" +import { Menu } from "../Menu" +import { Overlay } from "@/ui/Overlay" +import { useContext } from "react" +import { ConfigContext } from "src/context/ConfigContext" +import { Box } from "@/ui/Box" +import { Spacer } from "../Spacer" +import { useToggle } from "react-use" +import { HudozkaLogo } from "../HudozkaLogo" +import { useDarkTheme } from "@/hooks/useDarkTheme" +import { HudozkaTitle } from "../HudozkaTitle" +import Link from "next/link" + +export type MobileNavigationProps = { + style?: React.CSSProperties +} + +export const MobileNavigation: React.FC = ({ style }) => { + const dark = useDarkTheme() + const [open, toggleOpen] = useToggle(false) + const { menu } = useContext(ConfigContext) + + return ( + <> + + + + + + + + + + + + + + + + + + + + + + ) +} diff --git a/src/components/Navigation/index.tsx b/src/components/Navigation/index.tsx index 49983f09..6bdd8a7b 100644 --- a/src/components/Navigation/index.tsx +++ b/src/components/Navigation/index.tsx @@ -1,84 +1,25 @@ -import { MenuToggle } from "../MenuToggle" import { useMobile } from "src/hooks/useMobile" -import { Menu } from "../Menu" -import { Overlay } from "@/ui/Overlay" import { useContext } from "react" import { ConfigContext } from "src/context/ConfigContext" -import { Box } from "@/ui/Box" -import { Spacer } from "../Spacer" import { useToggle } from "react-use" -import { HudozkaLogo } from "../HudozkaLogo" import { useDarkTheme } from "@/hooks/useDarkTheme" -import { HudozkaTitle } from "../HudozkaTitle" -import Link from "next/link" +import { DesktopNavigation } from "./DesktopNavigation" +import { MobileNavigation } from "./MobileNavigation" export type NavigationProps = { style?: React.CSSProperties } -export const Navigation: React.FC = props => { +export const Navigation: React.FC = ({ style }) => { const mobile = useMobile() - const dark = useDarkTheme() - const [open, toggleOpen] = useToggle(false) - const { menu } = useContext(ConfigContext) + + if (mobile) { + return ( + + ) + } return ( - <> - - - - - - - - - - - - - - - - - - {!mobile ? null : ( - - )} - - {mobile ? null : ( - { - toggleOpen(false) - }} - /> - )} - - - - {!mobile ? null : ( - - )} - - + ) }