fix: sticky navbar

This commit is contained in:
tresabhi committed 2024-11-24 20:30:42 -06:00
1 parent e48c57068f
commit 2fe0e9379e
4 files changed
+105 -107

No files matched your search

@@ -133,7 +133,7 @@ const isBranchNamed = branchName !== undefined;
BlitzKit BlitzKit
{ {
isBranchNamed && ( isBranchNamed && (
<Code size="8" color="gray" highContrast variant="outline"> <Code size="8" color="gray" variant="outline">
{branchName} {branchName}
</Code> </Code>
) )
@@ -141,7 +141,7 @@ const isBranchNamed = branchName !== undefined;
</Flex> </Flex>
</Heading> </Heading>
<Text color="gray" align="center" size="4"> By TrèsAbhi ❤️ </Text> <Text color="gray" align="center" size="4">By TrèsAbhi ❤️</Text>
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>
+101 -103
View File
@@ -33,22 +33,21 @@ const isBranchNamed = branchName !== undefined;
height: var(--navbar-height); height: var(--navbar-height);
top: 0; top: 0;
z-index: 1; z-index: 1;
position: sticky;
} }
.expander { .expander {
--navbar-height: 48px; --navbar-height: 48px;
overflow: hidden; /* overflow: hidden; */
transition-duration: 250ms; transition-duration: 250ms;
width: 100%; width: 100%;
/* overflow: hidden; */
backdrop-filter: blur(4rem) brightness(0.75); backdrop-filter: blur(4rem) brightness(0.75);
-webkit-backdrop-filter: blur(4rem) brightness(0.75); -webkit-backdrop-filter: blur(4rem) brightness(0.75);
} }
.expander[data-expanded='false'] { .expander[data-expanded='false'] {
max-height: var(--navbar-height); height: var(--navbar-height);
min-height: 0;
} }
.expander[data-expanded='false'] *[data-expanded] { .expander[data-expanded='false'] *[data-expanded] {
@@ -56,14 +55,18 @@ const isBranchNamed = branchName !== undefined;
} }
.expander[data-expanded='true'] { .expander[data-expanded='true'] {
max-height: 200vh; height: 100vh;
min-height: 100vh;
} }
.expander[data-expanded='true'] *[data-closed] { .expander[data-expanded='true'] *[data-closed] {
display: none; display: none;
} }
.expander div[data-radix-scroll-area-viewport] {
overflow-y: scroll !important;
overscroll-behavior: contain;
}
.hamburger { .hamburger {
display: inline-flex; display: inline-flex;
} }
@@ -85,12 +88,6 @@ const isBranchNamed = branchName !== undefined;
max-height: var(--navbar-height) !important; max-height: var(--navbar-height) !important;
} }
} }
.scroll-area {
max-height: 200px;
height: 200px;
background-color: red;
}
</style> </style>
<script> <script>
@@ -112,31 +109,24 @@ const isBranchNamed = branchName !== undefined;
<Flex className="expander" data-expanded="false" direction="column" gap="2"> <Flex className="expander" data-expanded="false" direction="column" gap="2">
<Flex justify="center"> <Flex justify="center">
<Flex flexGrow="1" maxWidth="1024px" p="3" align="center"> <Flex flexGrow="1" maxWidth="1024px" p="3" align="center">
<Flex gap="3" align="center"> <Link
<IconButton variant="ghost" color="gray" className="hamburger"> color="gray"
<Cross1Icon data-expanded /> highContrast
<HamburgerMenuIcon data-closed /> href="/"
</IconButton> underline="hover"
weight="bold"
<Link >
color="gray" <Flex align="center" gap="1">
highContrast BlitzKit
href="/" {
underline="hover" isBranchNamed && (
weight="bold" <Code color="gray" size="1" variant="outline">
> {branchName}
<Flex align="center" gap="1"> </Code>
BlitzKit )
{ }
isBranchNamed && ( </Flex>
<Code color="gray" size="1" highContrast variant="outline"> </Link>
{branchName}
</Code>
)
}
</Flex>
</Link>
</Flex>
<Box flexGrow="1" /> <Box flexGrow="1" />
@@ -183,6 +173,7 @@ const isBranchNamed = branchName !== undefined;
> >
<DiscordLogoIcon /> <DiscordLogoIcon />
</Link> </Link>
<Link <Link
style={{ display: 'flex', alignContent: 'center' }} style={{ display: 'flex', alignContent: 'center' }}
color="gray" color="gray"
@@ -193,83 +184,90 @@ const isBranchNamed = branchName !== undefined;
</Link> </Link>
<NavbarAccount client:idle /> <NavbarAccount client:idle />
<IconButton variant="ghost" color="gray" className="hamburger">
<Cross1Icon data-expanded />
<HamburgerMenuIcon data-closed />
</IconButton>
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>
<Grid <ScrollArea scrollbars="vertical" style={{ height: '100%', width: '100%' }}>
columns="repeat(auto-fill, minmax(192px, 1fr))" <Grid
flow="dense" columns="repeat(auto-fill, minmax(12rem, 1fr))"
gap="2" flow="dense"
width="100%" gap="2"
p="3" width="100%"
pt="0" p="3"
> pt="0"
{ >
tools.map((tool) => { {
const unavailableOnBranch = tool.branches?.every( tools.map((tool) => {
(branch) => const unavailableOnBranch = tool.branches?.every(
branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH), (branch) =>
); branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH),
);
if (unavailableOnBranch) return null; if (unavailableOnBranch) return null;
return ( return (
<Flex <Flex
key={tool.id} key={tool.id}
style={{
position: 'relative',
borderRadius: 'var(--radius-2)',
overflow: 'hidden',
backgroundImage: `url(${imgur(tool.image, {
format: 'jpeg',
size: ImgurSize.MediumThumbnail,
})})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
aspectRatio: '2 / 1',
}}
>
<Link
href={tool.id.length === 0 ? '/' : `/tools/${tool.id}`}
style={{ style={{
display: 'flex', position: 'relative',
width: '100%', borderRadius: 'var(--radius-2)',
height: '100%', overflow: 'hidden',
flexDirection: 'column', backgroundImage: `url(${imgur(tool.image, {
textDecoration: 'none', format: 'jpeg',
color: 'inherit', size: ImgurSize.MediumThumbnail,
})})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
aspectRatio: '2 / 1',
}} }}
> >
<Box <Link
flexGrow="1" href={tool.id.length === 0 ? '/' : `/tools/${tool.id}`}
style={{ style={{
backgroundImage: `url(${imgur(tool.image, { display: 'flex',
format: 'jpeg', width: '100%',
size: ImgurSize.MediumThumbnail, height: '100%',
})})`, flexDirection: 'column',
backgroundSize: 'cover', textDecoration: 'none',
backgroundPosition: 'center', color: 'inherit',
}}
/>
<Flex
p="2"
align="center"
width="100%"
style={{
backgroundColor: 'var(--color-panel-translucent)',
backdropFilter: 'blur(4rem)',
WebkitBackdropFilter: 'blur(4rem)',
}} }}
> >
<Text weight="medium">{tool.title}</Text> <Box
</Flex> flexGrow="1"
</Link> style={{
</Flex> backgroundImage: `url(${imgur(tool.image, {
); format: 'jpeg',
}) size: ImgurSize.MediumThumbnail,
} })})`,
</Grid> backgroundSize: 'cover',
backgroundPosition: 'center',
}}
/>
<Flex
p="2"
align="center"
width="100%"
style={{
backgroundColor: 'var(--color-panel-translucent)',
backdropFilter: 'blur(4rem)',
WebkitBackdropFilter: 'blur(4rem)',
}}
>
<Text>{tool.title}</Text>
</Flex>
</Link>
</Flex>
);
})
}
</Grid>
</ScrollArea>
</Flex> </Flex>
</Flex> </Flex>
@@ -35,7 +35,7 @@ function Content() {
</IconButton> </IconButton>
</Popover.Trigger> </Popover.Trigger>
<BlitzKitTheme> <BlitzKitTheme style={{ display: 'contents' }}>
<Popover.Content <Popover.Content
align="end" align="end"
width="320px" width="320px"
+1 -1
View File
@@ -32,7 +32,7 @@ function Content() {
<Flex direction="column" gap="3" align="center"> <Flex direction="column" gap="3" align="center">
<Text size="5"> <Text size="5">
BlitzKit{' '} BlitzKit{' '}
<Code variant="outline" size="4" color="gray" highContrast> <Code variant="outline" size="4" color="gray">
opentest opentest
</Code>{' '} </Code>{' '}
is available now{' '} is available now{' '}