mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 12:39:49 +01:00
simplify
This commit is contained in:
1 parent
752b11e56d
commit
46fd061aff
1 file changed
+8
-44
@@ -5,7 +5,7 @@ import {
|
|||||||
GearIcon,
|
GearIcon,
|
||||||
HamburgerMenuIcon,
|
HamburgerMenuIcon,
|
||||||
} from "@radix-ui/react-icons";
|
} from "@radix-ui/react-icons";
|
||||||
import { Box, Code, Flex, IconButton, Link } from "@radix-ui/themes";
|
import { Box, Code, Flex, Grid, IconButton, Link } from "@radix-ui/themes";
|
||||||
import { resolveBranchName } from "../core/blitzkit/branches";
|
import { resolveBranchName } from "../core/blitzkit/branches";
|
||||||
import { getStrings } from "../core/i18n/getStrings";
|
import { getStrings } from "../core/i18n/getStrings";
|
||||||
import { Var } from "../core/radix/var";
|
import { Var } from "../core/radix/var";
|
||||||
@@ -20,7 +20,7 @@ export interface Props {
|
|||||||
|
|
||||||
const { integrated = false } = Astro.props;
|
const { integrated = false } = Astro.props;
|
||||||
const toolsFiltered = Object.values(tools).filter(
|
const toolsFiltered = Object.values(tools).filter(
|
||||||
(tool) => !tool.href && !tool.disabled
|
(tool) => !tool.href && !tool.disabled,
|
||||||
);
|
);
|
||||||
const { locale } = Astro.props;
|
const { locale } = Astro.props;
|
||||||
const branchName = resolveBranchName(locale);
|
const branchName = resolveBranchName(locale);
|
||||||
@@ -105,7 +105,7 @@ const strings = getStrings(locale);
|
|||||||
<Flex
|
<Flex
|
||||||
className="content"
|
className="content"
|
||||||
width="100%"
|
width="100%"
|
||||||
p={{ initial: "4", sm: "3" }}
|
p="3"
|
||||||
direction="column"
|
direction="column"
|
||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
@@ -133,41 +133,6 @@ const strings = getStrings(locale);
|
|||||||
|
|
||||||
<Box flexGrow="1" />
|
<Box flexGrow="1" />
|
||||||
|
|
||||||
<Flex
|
|
||||||
align="center"
|
|
||||||
gap={{ initial: "3", md: "6" }}
|
|
||||||
display={{ initial: "none", sm: "flex" }}
|
|
||||||
justify="center"
|
|
||||||
className="tools"
|
|
||||||
>
|
|
||||||
{
|
|
||||||
toolsFiltered.map((tool) => {
|
|
||||||
const selected = Astro.url.pathname.includes(`/${tool.id}`);
|
|
||||||
const toolStrings =
|
|
||||||
strings.website.tools[
|
|
||||||
(tool.strings ??
|
|
||||||
tool.id) as keyof typeof strings.website.tools
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LinkI18n
|
|
||||||
{locale}
|
|
||||||
weight={selected ? "medium" : "regular"}
|
|
||||||
color="gray"
|
|
||||||
highContrast={selected}
|
|
||||||
size={{ initial: "1", md: "2" }}
|
|
||||||
href={`/${tool.id}`}
|
|
||||||
underline="hover"
|
|
||||||
>
|
|
||||||
{toolStrings.name}
|
|
||||||
</LinkI18n>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Box flexGrow="1" />
|
|
||||||
|
|
||||||
<Flex align="center" gap="4">
|
<Flex align="center" gap="4">
|
||||||
<Link
|
<Link
|
||||||
style={{ display: "flex", alignContent: "center" }}
|
style={{ display: "flex", alignContent: "center" }}
|
||||||
@@ -191,7 +156,7 @@ const strings = getStrings(locale);
|
|||||||
|
|
||||||
<NavbarAccount {locale} client:idle />
|
<NavbarAccount {locale} client:idle />
|
||||||
|
|
||||||
<Flex align="center" display={{ initial: "flex", sm: "none" }}>
|
<Flex align="center">
|
||||||
<IconButton variant="ghost" color="gray" className="hamburger">
|
<IconButton variant="ghost" color="gray" className="hamburger">
|
||||||
<Cross1Icon data-expanded />
|
<Cross1Icon data-expanded />
|
||||||
<HamburgerMenuIcon data-closed />
|
<HamburgerMenuIcon data-closed />
|
||||||
@@ -200,11 +165,10 @@ const strings = getStrings(locale);
|
|||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex
|
<Grid
|
||||||
direction="column"
|
|
||||||
data-expanded
|
data-expanded
|
||||||
|
columns="repeat(auto-fill, minmax(30rem, 1fr))"
|
||||||
gap="3"
|
gap="3"
|
||||||
display={{ initial: "flex", sm: "none" }}
|
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
toolsFiltered.map((tool) => {
|
toolsFiltered.map((tool) => {
|
||||||
@@ -229,7 +193,7 @@ const strings = getStrings(locale);
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
py="4"
|
p="6"
|
||||||
justify="end"
|
justify="end"
|
||||||
flexGrow="1"
|
flexGrow="1"
|
||||||
style={{
|
style={{
|
||||||
@@ -243,7 +207,7 @@ const strings = getStrings(locale);
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</Flex>
|
</Grid>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user