Files
blitzkit/packages/website/src/components/ToolCard.astro
T

129 lines
2.9 KiB
Plaintext
Raw Normal View History

2024-09-14 13:24:24 -05:00
---
2025-09-13 21:54:43 -05:00
import { CaretRightIcon } from "@radix-ui/react-icons";
2025-09-13 22:53:29 -05:00
import {
Box,
Button,
Flex,
Heading,
Text,
type ButtonProps,
} from "@radix-ui/themes";
2025-09-13 21:54:43 -05:00
import type { Tool } from "../constants/tools";
import { getStrings } from "../core/i18n/getStrings";
import { LinkI18n } from "./LinkI18n";
2024-09-14 13:24:24 -05:00
interface Props {
tool: Tool;
2025-10-22 17:52:01 -05:00
locale: string;
2024-09-14 13:24:24 -05:00
}
2025-10-22 17:52:01 -05:00
const { locale, tool } = Astro.props;
2025-01-06 20:09:11 -06:00
const strings = getStrings(locale);
const toolStrings =
strings.website.tools[
2025-09-13 21:54:43 -05:00
(tool.strings ?? tool.id) as keyof typeof strings.website.tools
2025-01-06 20:09:11 -06:00
];
2024-09-14 13:24:24 -05:00
---
<style>
.container {
border-radius: var(--radius-2);
background-size: cover;
background-position: center;
height: 16rem;
2025-09-13 21:54:43 -05:00
&[data-disabled="true"] {
2024-09-14 13:24:24 -05:00
opacity: 0.25;
}
2025-09-13 21:54:43 -05:00
&[data-significant="true"] {
width: 100%;
2024-09-14 13:24:24 -05:00
height: min(20rem, 50vh);
}
}
.link {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
color: inherit;
}
</style>
<Flex
2025-09-13 22:53:29 -05:00
style={{
backgroundImage: `url(/assets/images/tools/${tool.id}.webp)`,
}}
2024-09-14 18:32:36 -05:00
data-significant={tool.significant}
className="container"
position="relative"
overflow="hidden"
2025-09-13 21:54:43 -05:00
flexGrow={tool.significant ? undefined : "1"}
flexBasis={tool.significant ? undefined : { initial: undefined, sm: "0" }}
2024-09-14 13:24:24 -05:00
>
2024-12-27 14:01:59 -06:00
<LinkI18n
{locale}
2024-09-14 13:24:24 -05:00
className="link"
underline="none"
2025-09-13 21:54:43 -05:00
href={tool.href ?? `/${tool.id}`}
target={tool.href ? "_blank" : undefined}
2024-09-14 13:24:24 -05:00
>
<Box
flexGrow="1"
style={{
2025-04-05 16:00:52 -05:00
backgroundImage: `url(/assets/images/tools/${tool.id}.webp)`,
2025-09-13 21:54:43 -05:00
backgroundSize: "cover",
backgroundPosition: "center",
2024-09-14 13:24:24 -05:00
}}
/>
<Flex
2025-09-13 21:54:43 -05:00
px={{ initial: "6", md: tool.significant ? "8" : "6" }}
py={{ initial: "4", sm: tool.significant ? "6" : "4" }}
2024-09-14 13:24:24 -05:00
gap="4"
align="center"
justify="between"
width="100%"
2025-09-13 21:54:43 -05:00
direction={{ initial: "column", xs: "row" }}
2024-09-14 13:24:24 -05:00
style={{
2025-09-13 21:54:43 -05:00
backgroundColor: "var(--color-panel-translucent)",
backdropFilter: "blur(64px)",
WebkitBackdropFilter: "blur(64px)",
2024-09-14 13:24:24 -05:00
}}
>
<Flex
direction="column"
justify="center"
2025-09-13 21:54:43 -05:00
align={{ initial: "center", xs: "start" }}
2024-09-14 13:24:24 -05:00
>
<Heading
2025-09-13 21:54:43 -05:00
align={{ initial: "center", sm: "left" }}
size={{ initial: "6", sm: tool.significant ? "7" : "5" }}
2024-09-14 13:24:24 -05:00
weight="medium"
>
2025-01-06 20:09:11 -06:00
{toolStrings.name}
2024-09-14 13:24:24 -05:00
</Heading>
<Text
2025-09-13 21:54:43 -05:00
align={{ initial: "center", sm: "left" }}
size={{ initial: "3", sm: tool.significant ? "4" : "3" }}
2024-09-14 13:24:24 -05:00
color="gray"
>
2025-09-13 21:54:43 -05:00
{toolStrings.description}
2024-09-14 13:24:24 -05:00
</Text>
</Flex>
2025-09-13 21:54:43 -05:00
<Button
size={{
initial: undefined,
sm: tool.significant ? "3" : undefined,
}}
2025-09-13 22:53:29 -05:00
color={tool.button as ButtonProps["color"]}
2025-09-13 21:54:43 -05:00
style={{ cursor: "inherit" }}
>
{toolStrings.button}
<CaretRightIcon />
</Button>
2024-09-14 13:24:24 -05:00
</Flex>
2024-12-27 14:01:59 -06:00
</LinkI18n>
2024-09-14 13:24:24 -05:00
</Flex>