mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: aeson navbar
This commit is contained in:
1 parent
386cca7226
commit
4062a09c05
1 file changed
+41
-47
@@ -14,7 +14,6 @@ import {
|
|||||||
IconButton,
|
IconButton,
|
||||||
Link as LinkRadix,
|
Link as LinkRadix,
|
||||||
Popover,
|
Popover,
|
||||||
ScrollArea,
|
|
||||||
Spinner,
|
Spinner,
|
||||||
Text,
|
Text,
|
||||||
} from '@radix-ui/themes';
|
} from '@radix-ui/themes';
|
||||||
@@ -38,7 +37,7 @@ export const NAVBAR_HEIGHT = 64;
|
|||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
const wideFormat = useWideFormat(480);
|
const wideFormat = useWideFormat(480);
|
||||||
const login = useApp((state) => state.login);
|
const login = useApp((state) => state.login);
|
||||||
const [showHamburgerMenu, setShowHamburgerMenu] = useState(false);
|
const [showHamburgerMenu, setShowHamburgerMenu] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!login) return;
|
if (!login) return;
|
||||||
@@ -93,20 +92,17 @@ export default function Navbar() {
|
|||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: showHamburgerMenu ? 176 : NAVBAR_HEIGHT + 1, // extra pixel for frost bleeding
|
maxHeight: showHamburgerMenu ? '100%' : NAVBAR_HEIGHT + 1, // extra pixel for frost bleeding
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
padding: '1rem',
|
padding: '1rem',
|
||||||
background: theme.colors.appBackground1_alpha,
|
background: theme.colors.appBackground1_alpha,
|
||||||
borderBottom: theme.borderStyles.nonInteractive,
|
borderBottom: theme.borderStyles.nonInteractive,
|
||||||
backdropFilter: 'blur(4rem)',
|
backdropFilter: 'blur(4rem)',
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
transition: 'height 0.2s ease',
|
transition: 'max-height 0.5s ease',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
}}
|
}}
|
||||||
onPointerEnter={() => {
|
onPointerEnter={() => setShowHamburgerMenu(true)}
|
||||||
console.log('open!');
|
|
||||||
setShowHamburgerMenu(true);
|
|
||||||
}}
|
|
||||||
onPointerLeave={() => setShowHamburgerMenu(false)}
|
onPointerLeave={() => setShowHamburgerMenu(false)}
|
||||||
>
|
>
|
||||||
<Flex direction="column" align="center" pt="2">
|
<Flex direction="column" align="center" pt="2">
|
||||||
@@ -204,49 +200,47 @@ export default function Navbar() {
|
|||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<ScrollArea scrollbars="horizontal">
|
<Flex mt="6" gap="3" justify="center" wrap="wrap">
|
||||||
<Flex mt="6" gap="3" justify="center">
|
{TOOLS.filter((tool) => !tool.href).map((tool) => (
|
||||||
{TOOLS.filter((tool) => !tool.href).map((tool) => (
|
<Link
|
||||||
<Link
|
href={tool.href ?? `/tools/${tool.id}`}
|
||||||
href={tool.href ?? `/tools/${tool.id}`}
|
target={tool.href ? '_blank' : undefined}
|
||||||
target={tool.href ? '_blank' : undefined}
|
className={
|
||||||
className={
|
tool.disabled ? styles.tool.disabled : styles.tool.enabled
|
||||||
tool.disabled ? styles.tool.disabled : styles.tool.enabled
|
}
|
||||||
}
|
style={{
|
||||||
|
backgroundImage: `url(/assets/banners/${tool.id}.webp)`,
|
||||||
|
cursor: tool.disabled ? 'default' : 'pointer',
|
||||||
|
opacity: tool.disabled ? 0.25 : 1,
|
||||||
|
height: 64,
|
||||||
|
width: 144,
|
||||||
|
borderRadius: 8,
|
||||||
|
textDecoration: 'none',
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
overflow: 'hidden',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
padding: 8,
|
||||||
|
transition: `box-shadow ${theme.durations.regular}`,
|
||||||
|
}}
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(/assets/banners/${tool.id}.webp)`,
|
color: theme.colors.textHighContrast,
|
||||||
cursor: tool.disabled ? 'default' : 'pointer',
|
|
||||||
opacity: tool.disabled ? 0.25 : 1,
|
|
||||||
height: 64,
|
|
||||||
width: 144,
|
|
||||||
borderRadius: 8,
|
|
||||||
textDecoration: 'none',
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
backgroundPosition: 'center',
|
|
||||||
overflow: 'hidden',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
alignItems: 'center',
|
||||||
alignItems: 'flex-start',
|
justifyContent: 'center',
|
||||||
justifyContent: 'flex-end',
|
|
||||||
padding: 8,
|
|
||||||
transition: `box-shadow ${theme.durations.regular}`,
|
|
||||||
}}
|
}}
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
|
||||||
>
|
>
|
||||||
<Text
|
{tool.title}
|
||||||
style={{
|
</Text>
|
||||||
color: theme.colors.textHighContrast,
|
</Link>
|
||||||
display: 'flex',
|
))}
|
||||||
alignItems: 'center',
|
</Flex>
|
||||||
justifyContent: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{tool.title}
|
|
||||||
</Text>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</Flex>
|
|
||||||
</ScrollArea>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in new issue
Block a user