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

103 lines
2.0 KiB
Plaintext
Raw Normal View History

2026-01-09 14:04:59 -06:00
---
import { CaretRightIcon } from "@radix-ui/react-icons";
2026-01-10 12:43:39 -06:00
import { api } from "../core/api/dynamic";
import { type Tool } from "../core/tools/tools";
2026-01-09 14:04:59 -06:00
import { Button } from "./Button";
2026-01-10 13:19:59 -06:00
import { LinkI18n } from "./LinkI18n";
2026-01-09 14:04:59 -06:00
import { Text } from "./Text";
interface Props {
tool: Tool;
2026-01-10 12:43:39 -06:00
locale: string;
2026-01-31 22:54:00 -06:00
gradient?: boolean;
2026-01-09 14:04:59 -06:00
}
2026-01-31 22:54:00 -06:00
const { tool, locale, gradient } = Astro.props;
2026-01-10 12:43:39 -06:00
const strings = await api.strings(locale);
const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
2026-01-09 14:04:59 -06:00
---
<style>
.tool-card {
2026-04-17 23:35:56 -05:00
display: flex;
2026-01-10 12:43:39 -06:00
flex-direction: column;
height: 10rem;
2026-01-10 13:49:11 -06:00
position: relative;
2026-01-31 23:21:43 -06:00
align-items: stretch;
gap: 0;
2026-01-10 12:43:39 -06:00
border-radius: var(--space-3);
background-size: cover;
background-position: center;
overflow: hidden;
2026-01-31 22:54:00 -06:00
&[data-gradient="true"] {
height: 10rem;
2026-01-25 16:13:36 -06:00
}
2026-01-10 12:43:39 -06:00
.poster {
flex: 1;
background-size: cover;
background-position: center;
2026-01-31 22:54:00 -06:00
.gradient {
width: 100%;
height: 100%;
background: linear-gradient(var(--gray-1), transparent);
}
2026-01-10 12:43:39 -06:00
}
.info {
display: flex;
justify-content: space-between;
padding: var(--space-4);
backdrop-filter: blur(var(--space-6));
.readable {
display: flex;
flex-direction: column;
2026-04-26 20:06:59 -05:00
.title {
color: red;
}
2026-01-10 12:43:39 -06:00
}
}
2026-01-09 14:04:59 -06:00
}
</style>
2026-01-10 13:19:59 -06:00
<LinkI18n
{locale}
href={`/${tool.id}`}
className="tool-card"
underline="never"
2026-01-10 12:43:39 -06:00
style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}}
2026-01-31 22:54:00 -06:00
data-gradient={gradient}
2026-01-10 12:43:39 -06:00
>
<div
class="poster"
style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}}
>
2026-01-31 22:54:00 -06:00
{gradient && <div class="gradient" />}
2026-01-10 12:43:39 -06:00
</div>
<div class="info">
<div class="readable">
2026-04-26 20:06:59 -05:00
<Text weight="medium" color="white">{toolStrings.name}</Text>
2026-01-10 12:43:39 -06:00
<Text size="minor" lowContrast>{toolStrings.slogan}</Text>
2026-01-09 14:04:59 -06:00
</div>
2026-01-25 16:13:36 -06:00
<Button color={tool.accent}>
2026-01-10 12:43:39 -06:00
{toolStrings.action}
2026-01-09 14:04:59 -06:00
<CaretRightIcon />
</Button>
</div>
2026-01-10 13:19:59 -06:00
</LinkI18n>