From 7eda4825ea45586c84786657f3855a11d9da3713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:42:57 -0500 Subject: [PATCH] feat: more navbar buttons --- src/app/layout.tsx | 2 +- src/components/Navbar/index.tsx | 40 +++++++++++++++++++++++++++++---- src/hooks/useWideFormat.ts | 8 +++---- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index cfc75db94..81b56377d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -72,7 +72,7 @@ export default function RootLayout({ children }: RootLayoutProps) { > {!isEmbed && } diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index 787e3dfd5..eafee4a4b 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -1,13 +1,19 @@ -import { HamburgerMenuIcon } from '@radix-ui/react-icons'; +import { + GearIcon, + HamburgerMenuIcon, + MagnifyingGlassIcon, +} from '@radix-ui/react-icons'; import { Flex, IconButton, Popover } from '@radix-ui/themes'; import Link from 'next/link'; import { useFullScreen } from '../../hooks/useFullScreen'; +import { useWideFormat } from '../../hooks/useWideFormat'; import { BlitzkriegWormWide } from '../../icons/BlitzkriegWormWide'; import { theme } from '../../stitches.config'; import { EverythingSearch } from './components/EverythingSearch'; export default function Navbar() { const isFullScreen = useFullScreen(); + const wideFormat = useWideFormat(600); // const pathName = usePathname(); if (isFullScreen) return null; @@ -19,6 +25,7 @@ export default function Navbar() { top: 0, left: 0, width: '100%', + height: 64 + 1, // extra pixel for frost bleeding zIndex: 1, padding: '1rem', background: theme.colors.appBackground1_alpha, @@ -27,7 +34,12 @@ export default function Navbar() { boxSizing: 'border-box', }} > - + - + {wideFormat ? ( + + ) : ( +
+ )} + + {!wideFormat && ( + + + + )} - + + + + + + + + + + + {/* 880; -} +export function useWideFormat(size = 880) { + function hasWideFormat() { + return typeof window !== 'undefined' && window.innerWidth > size; + } -export function useWideFormat() { const [wideFormat, setWideFormat] = useState(hasWideFormat()); useEffect(() => {