feat: more things

This commit is contained in:
TrèsAbhi committed 2024-08-17 20:00:01 -05:00
1 parent 4b88a52fcf
commit bc9e1c3007
2 files changed
+133 -15

No files matched your search

+33 -2
View File
@@ -1,6 +1,7 @@
import { style } from '@vanilla-extract/css'; import { style, styleVariants } from '@vanilla-extract/css';
const MIN_WIDTH = 640 + 64; const MIN_WIDTH = 640 + 128;
const HEIGHT = 48;
export const hamburger = style({ export const hamburger = style({
display: 'inline-flex', display: 'inline-flex',
@@ -21,3 +22,33 @@ export const tools = style({
}, },
}, },
}); });
const navbarBase = style({
// 1px overlap with content to bleed color
marginBottom: -1,
backdropFilter: 'blur(4rem) brightness(0.75)',
WebkitBackdropFilter: 'blur(4rem) brightness(0.75)',
zIndex: 1,
transitionDuration: '250ms',
'@media': {
[`screen and (min-width: ${MIN_WIDTH}px)`]: {
maxHeight: HEIGHT,
},
},
});
export const navbar = styleVariants({
false: [
navbarBase,
{
maxHeight: HEIGHT,
},
],
true: [
navbarBase,
{
maxHeight: '100vh',
},
],
});
+100 -13
View File
@@ -1,15 +1,25 @@
'use client'; 'use client';
import { import {
Cross1Icon,
DiscordLogoIcon, DiscordLogoIcon,
GearIcon, GearIcon,
HamburgerMenuIcon, HamburgerMenuIcon,
PersonIcon, PersonIcon,
} from '@radix-ui/react-icons'; } from '@radix-ui/react-icons';
import { Box, Flex, IconButton, Separator } from '@radix-ui/themes'; import {
Box,
Flex,
Grid,
IconButton,
ScrollArea,
Separator,
Text,
} from '@radix-ui/themes';
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
import { useState } from 'react'; import { useState } from 'react';
import { TOOLS } from '../../constants/tools'; import { TOOLS } from '../../constants/tools';
import { imgur, ImgurSize } from '../../core/blitzkit/imgur';
import { PatreonIcon } from '../../icons/Patreon'; import { PatreonIcon } from '../../icons/Patreon';
import * as App from '../../stores/app'; import * as App from '../../stores/app';
import { Link } from '../Link'; import { Link } from '../Link';
@@ -23,21 +33,22 @@ export default function Navbar() {
return ( return (
<Flex <Flex
justify="center" direction="column"
position="sticky" position="sticky"
top="0" top="0"
style={{ className={styles.navbar[`${showHamburgerMenu}`]}
// 1px overlap with content to bleed color overflow="hidden"
marginBottom: -1,
backdropFilter: 'blur(4rem) brightness(0.75)',
WebkitBackdropFilter: 'blur(4rem) brightness(0.75)',
zIndex: 1,
}}
> >
<Flex flexGrow="1" maxWidth="1024px" p="2" align="center"> <Flex justify="center">
<Flex flexGrow="1" maxWidth="1024px" p="3" align="center">
<Flex gap="3" align="center"> <Flex gap="3" align="center">
<IconButton variant="ghost" color="gray" className={styles.hamburger}> <IconButton
<HamburgerMenuIcon /> variant="ghost"
color="gray"
className={styles.hamburger}
onClick={() => setShowHamburgerMenu((state) => !state)}
>
{showHamburgerMenu ? <Cross1Icon /> : <HamburgerMenuIcon />}
</IconButton> </IconButton>
<Link <Link
@@ -46,6 +57,7 @@ export default function Navbar() {
href="/" href="/"
underline="hover" underline="hover"
weight="bold" weight="bold"
onClick={() => setShowHamburgerMenu(false)}
> >
BlitzKit BlitzKit
</Link> </Link>
@@ -53,7 +65,12 @@ export default function Navbar() {
<Box flexGrow="1" /> <Box flexGrow="1" />
<Flex align="center" gap="2" justify="center" className={styles.tools}> <Flex
align="center"
gap="2"
justify="center"
className={styles.tools}
>
{TOOLS.map((tool, index) => { {TOOLS.map((tool, index) => {
const selected = pathname.startsWith(`/tools/${tool.id}`); const selected = pathname.startsWith(`/tools/${tool.id}`);
@@ -84,6 +101,7 @@ export default function Navbar() {
href="https://discord.gg/nDt7AjGJQH" href="https://discord.gg/nDt7AjGJQH"
underline="none" underline="none"
target="_blank" target="_blank"
onClick={() => setShowHamburgerMenu(false)}
> >
<DiscordLogoIcon /> <DiscordLogoIcon />
</Link> </Link>
@@ -93,6 +111,7 @@ export default function Navbar() {
href="https://discord.gg/nDt7AjGJQH" href="https://discord.gg/nDt7AjGJQH"
underline="none" underline="none"
target="_blank" target="_blank"
onClick={() => setShowHamburgerMenu(false)}
> >
<PatreonIcon width="0.75em" height="0.75em" /> <PatreonIcon width="0.75em" height="0.75em" />
</Link> </Link>
@@ -102,6 +121,7 @@ export default function Navbar() {
href="/settings" href="/settings"
underline="none" underline="none"
target="_blank" target="_blank"
onClick={() => setShowHamburgerMenu(false)}
> >
<GearIcon /> <GearIcon />
</Link> </Link>
@@ -111,5 +131,72 @@ export default function Navbar() {
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>
<ScrollArea>
<Flex justify="center">
<Grid
columns="repeat(auto-fill, minmax(128px, 1fr))"
flow="dense"
gap="2"
width="100%"
p="4"
pt="0"
>
{TOOLS.map((tool) => (
<Flex
style={{
position: 'relative',
borderRadius: 'var(--radius-2)',
overflow: 'hidden',
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.LargeThumbnail })})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
aspectRatio: '4 / 3',
}}
onClick={() => setShowHamburgerMenu(false)}
>
<Link
href={`/tools/${tool.id}`}
style={{
display: 'flex',
width: '100%',
height: '100%',
flexDirection: 'column',
textDecoration: 'none',
color: 'inherit',
}}
>
<Box
flexGrow="1"
style={{
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.LargeThumbnail })})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
}}
/>
<Flex
p="2"
align="center"
width="100%"
direction={{
initial: 'column',
sm: 'row',
}}
style={{
backgroundColor: 'var(--color-panel-translucent)',
backdropFilter: 'blur(4rem)',
WebkitBackdropFilter: 'blur(4rem)',
}}
>
<Text weight="medium">{tool.title}</Text>
</Flex>
</Link>
</Flex>
))}
</Grid>
</Flex>
</ScrollArea>
</Flex>
); );
} }