feat: cards

This commit is contained in:
TrèsAbhi committed 2026-01-10 12:43:39 -06:00
1 parent d42fc0e3f6
commit 9096644d51
9 files changed
+98 -19

No files matched your search

+20 -4
View File
@@ -20,10 +20,26 @@
},
"tools": {
"tanks": { "name": "Tankopedia" },
"avatars": { "name": "Avatars" },
"backgrounds": { "name": "Backgrounds" },
"api": { "name": "API" }
"tanks": {
"name": "Tankopedia",
"slogan": "Blitz tank encyclopedia",
"action": "Find tanks"
},
"avatars": {
"name": "Avatars",
"slogan": "Blitz player avatars",
"action": "Browse all"
},
"backgrounds": {
"name": "Backgrounds",
"slogan": "Blitz player backgrounds",
"action": "View all"
},
"api": {
"name": "API",
"action": "To the docs",
"slogan": "BlitzKit hosted API"
}
},
"home": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 405 KiB

@@ -18,7 +18,8 @@ import "@fontsource-variable/roboto-flex";
--max-size: max(100vw, 100vh);
--font-size-regular: var(--space-4);
--font-size-regular: 1rem;
--font-size-minor: 0.75rem;
--font-family-regular: "Roboto Flex Variable", sans-serif;
--font-family-mono: "JetBrains Mono Variable", monospace;
@@ -1,8 +1,11 @@
import type { ComponentProps } from "react";
import { classNames } from "../../core/ui/classNames";
import type { Color } from "../../core/ui/color";
import "./index.css";
export interface ButtonProps extends ComponentProps<"button"> {}
export interface ButtonProps extends ComponentProps<"button"> {
color?: Color;
}
export function Button({ className, ...props }: ButtonProps) {
return <button className={classNames("button", className)} {...props} />;
@@ -1,3 +1,7 @@
.text {
font-size: var(--font-size-regular);
&[data-size="minor"] {
font-size: var(--font-size-minor);
}
}
@@ -6,18 +6,21 @@ import "./index.css";
export interface TextProps extends ComponentProps<"span"> {
color?: Color;
lowContrast?: boolean;
size?: "regular" | "minor";
}
export function Text({
color = "gray",
lowContrast,
className,
size = "regular",
...props
}: TextProps) {
return (
<span
className={classNames("text", className)}
style={{ color: `var(--${color}-${lowContrast ? 11 : 12})` }}
data-size={size}
{...props}
/>
);
@@ -1,30 +1,76 @@
---
import { CaretRightIcon } from "@radix-ui/react-icons";
import type { Tool } from "../core/tools/tools";
import { api } from "../core/api/dynamic";
import { type Tool } from "../core/tools/tools";
import { Button } from "./Button";
import { Text } from "./Text";
interface Props {
tool: Tool;
locale: string;
}
const { tool } = Astro.props;
const { tool, locale } = Astro.props;
const strings = await api.strings(locale);
const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
---
<style>
.tool-card {
display: flex;
flex-direction: column;
height: 10rem;
border-radius: var(--space-3);
background-size: cover;
background-position: center;
overflow: hidden;
.poster {
flex: 1;
background-size: cover;
background-position: center;
}
.info {
display: flex;
justify-content: space-between;
padding: var(--space-4);
backdrop-filter: blur(var(--space-6));
.readable {
display: flex;
flex-direction: column;
}
}
}
</style>
<div class="tool-card">
<div>
<div>
<Text>{tool.id}</Text>
<Text>{tool.id}</Text>
<div
class="tool-card"
style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}}
>
<div
class="poster"
style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}}
>
</div>
<div class="info">
<div class="readable">
<Text>{toolStrings.name}</Text>
<Text size="minor" lowContrast>{toolStrings.slogan}</Text>
</div>
<Button>
{tool.id}
<Button color={tool.button}>
{toolStrings.action}
<CaretRightIcon />
</Button>
</div>
@@ -2,7 +2,6 @@
import locales from "@blitzkit/i18n/locales.json";
import "@radix-ui/colors/amber-dark.css";
import type { GetStaticPaths } from "astro";
import packageJson from "../../../../../package.json";
import HomeHero from "../../components/HomeHero.astro";
import ToolCard from "../../components/ToolCard.astro";
import { tools } from "../../core/tools/tools";
@@ -20,10 +19,17 @@ export const getStaticPaths = (() => {
const { locale } = Astro.props;
---
<style>
.cards {
display: flex;
flex-direction: column;
}
</style>
<BaseLayout accent="amber">
<HomeHero {locale} />
<h1>blitzkit {packageJson.version}</h1>
{Object.values(tools).map((tool) => <ToolCard {tool} />)}
<div class="cards">
{Object.values(tools).map((tool) => <ToolCard {locale} {tool} />)}
</div>
</BaseLayout>