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

104 lines
2.0 KiB
Plaintext
Raw Normal View History

2024-09-14 13:24:24 -05:00
---
2026-09-23 13:48:50 -05:00
import { api } from "../api/dynamic";
2025-09-13 21:54:43 -05:00
import type { Tool } from "../constants/tools";
2026-08-18 13:02:59 -05:00
import { Heading } from "./Heading";
2025-09-13 21:54:43 -05:00
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;
2026-08-18 13:21:51 -05:00
minor?: boolean;
2024-09-14 13:24:24 -05:00
}
2026-08-18 13:21:51 -05:00
const { locale, tool, minor } = Astro.props;
2026-09-23 13:48:50 -05:00
const strings = await api.strings(locale);
2025-01-06 20:09:11 -06:00
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 {
2026-08-18 13:21:51 -05:00
flex: 1;
2026-08-18 13:02:59 -05:00
display: flex;
2026-08-18 13:21:51 -05:00
border-radius: var(--space-3);
2024-09-14 13:24:24 -05:00
background-size: cover;
background-position: center;
2026-08-18 13:02:59 -05:00
position: relative;
overflow: hidden;
2025-09-13 21:54:43 -05:00
&[data-disabled="true"] {
2024-09-14 13:24:24 -05:00
opacity: 0.25;
}
}
.link {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
color: inherit;
2026-08-18 13:02:59 -05:00
.background {
flex: 1;
background-size: cover;
background-position: center;
}
.content {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
2026-08-18 13:21:51 -05:00
padding: var(--space-5);
box-sizing: border-box;
backdrop-filter: blur(64px);
-webkit-backdrop-filter: blur(64px);
&[data-minor="true"] {
padding: var(--space-4);
}
2026-08-18 13:02:59 -05:00
.wrapper {
display: flex;
flex-direction: column;
justify-content: center;
}
}
2024-09-14 13:24:24 -05:00
}
</style>
2026-08-18 13:02:59 -05:00
<div
2026-08-28 10:42:57 -05:00
style={{ backgroundImage: `url(/media/tools/banners/${tool.id}.webp)` }}
2026-08-18 13:02:59 -05:00
class="container"
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"
2026-08-18 13:21:51 -05:00
underline="never"
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
>
2026-08-18 13:02:59 -05:00
<div
class="background"
2026-08-28 10:42:57 -05:00
style={{ backgroundImage: `url(/media/tools/banners/${tool.id}.webp)` }}
2026-08-18 13:02:59 -05:00
>
</div>
2024-09-14 13:24:24 -05:00
2026-08-18 13:21:51 -05:00
<div class="content" data-minor={minor}>
2026-08-18 13:02:59 -05:00
<div class="wrapper">
2026-08-18 13:21:51 -05:00
<Heading size={minor ? "3" : "2"} weight="medium">
2025-01-06 20:09:11 -06:00
{toolStrings.name}
2024-09-14 13:24:24 -05:00
</Heading>
2026-08-18 13:02:59 -05:00
</div>
</div>
2024-12-27 14:01:59 -06:00
</LinkI18n>
2026-08-18 13:02:59 -05:00
</div>