feat: more navbar buttons

This commit is contained in:
TrèsAbhi committed 2024-04-18 18:42:57 -05:00
1 parent 60f0eb9a3c
commit 7eda4825ea
3 files changed
+41 -9

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
> >
<Flex <Flex
direction="column" direction="column"
style={{ minHeight: '100vh', paddingTop: isEmbed ? undefined : 52 }} style={{ minHeight: '100vh', paddingTop: isEmbed ? undefined : 64 }}
> >
{!isEmbed && <Navbar />} {!isEmbed && <Navbar />}
<AlertDialog.Root open={showDevBuildAlert}> <AlertDialog.Root open={showDevBuildAlert}>
+36 -4
View File
@@ -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 { Flex, IconButton, Popover } from '@radix-ui/themes';
import Link from 'next/link'; import Link from 'next/link';
import { useFullScreen } from '../../hooks/useFullScreen'; import { useFullScreen } from '../../hooks/useFullScreen';
import { useWideFormat } from '../../hooks/useWideFormat';
import { BlitzkriegWormWide } from '../../icons/BlitzkriegWormWide'; import { BlitzkriegWormWide } from '../../icons/BlitzkriegWormWide';
import { theme } from '../../stitches.config'; import { theme } from '../../stitches.config';
import { EverythingSearch } from './components/EverythingSearch'; import { EverythingSearch } from './components/EverythingSearch';
export default function Navbar() { export default function Navbar() {
const isFullScreen = useFullScreen(); const isFullScreen = useFullScreen();
const wideFormat = useWideFormat(600);
// const pathName = usePathname(); // const pathName = usePathname();
if (isFullScreen) return null; if (isFullScreen) return null;
@@ -19,6 +25,7 @@ export default function Navbar() {
top: 0, top: 0,
left: 0, left: 0,
width: '100%', width: '100%',
height: 64 + 1, // extra pixel for frost bleeding
zIndex: 1, zIndex: 1,
padding: '1rem', padding: '1rem',
background: theme.colors.appBackground1_alpha, background: theme.colors.appBackground1_alpha,
@@ -27,7 +34,12 @@ export default function Navbar() {
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
<Flex justify="center"> <Flex
justify="center"
style={{
height: '100%',
}}
>
<Flex <Flex
justify="between" justify="between"
align="center" align="center"
@@ -46,16 +58,36 @@ export default function Navbar() {
<BlitzkriegWormWide /> <BlitzkriegWormWide />
</Link> </Link>
<EverythingSearch style={{ flex: 1 }} /> {wideFormat ? (
<EverythingSearch style={{ flex: 1 }} />
) : (
<div style={{ flex: 1 }} />
)}
{!wideFormat && (
<IconButton variant="ghost" color="gray">
<MagnifyingGlassIcon />
</IconButton>
)}
<Popover.Root> <Popover.Root>
<Popover.Trigger> <Popover.Trigger>
<IconButton variant="ghost"> <IconButton variant="ghost" color="gray">
<HamburgerMenuIcon /> <HamburgerMenuIcon />
</IconButton> </IconButton>
</Popover.Trigger> </Popover.Trigger>
<Popover.Content></Popover.Content>
</Popover.Root> </Popover.Root>
<Link href="/settings">
<Flex style={{ width: '100%', height: '100%' }} justify="center">
<IconButton variant="ghost" color="gray">
<GearIcon />
</IconButton>
</Flex>
</Link>
{/* <Flex justify="center" align="center" gap="4"> {/* <Flex justify="center" align="center" gap="4">
<Link <Link
href="https://discord.gg/nDt7AjGJQH" href="https://discord.gg/nDt7AjGJQH"
+4 -4
View File
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
function hasWideFormat() { export function useWideFormat(size = 880) {
return typeof window !== 'undefined' && window.innerWidth > 880; function hasWideFormat() {
} return typeof window !== 'undefined' && window.innerWidth > size;
}
export function useWideFormat() {
const [wideFormat, setWideFormat] = useState(hasWideFormat()); const [wideFormat, setWideFormat] = useState(hasWideFormat());
useEffect(() => { useEffect(() => {