mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: cards
This commit is contained in:
1 parent
d42fc0e3f6
commit
9096644d51
9 files changed
+98
-19
No files matched your search
@@ -20,10 +20,26 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"tools": {
|
"tools": {
|
||||||
"tanks": { "name": "Tankopedia" },
|
"tanks": {
|
||||||
"avatars": { "name": "Avatars" },
|
"name": "Tankopedia",
|
||||||
"backgrounds": { "name": "Backgrounds" },
|
"slogan": "Blitz tank encyclopedia",
|
||||||
"api": { "name": "API" }
|
"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": {
|
"home": {
|
||||||
|
|||||||
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 405 KiB |
@@ -18,7 +18,8 @@ import "@fontsource-variable/roboto-flex";
|
|||||||
|
|
||||||
--max-size: max(100vw, 100vh);
|
--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-regular: "Roboto Flex Variable", sans-serif;
|
||||||
--font-family-mono: "JetBrains Mono Variable", monospace;
|
--font-family-mono: "JetBrains Mono Variable", monospace;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import type { ComponentProps } from "react";
|
import type { ComponentProps } from "react";
|
||||||
import { classNames } from "../../core/ui/classNames";
|
import { classNames } from "../../core/ui/classNames";
|
||||||
|
import type { Color } from "../../core/ui/color";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
export interface ButtonProps extends ComponentProps<"button"> {}
|
export interface ButtonProps extends ComponentProps<"button"> {
|
||||||
|
color?: Color;
|
||||||
|
}
|
||||||
|
|
||||||
export function Button({ className, ...props }: ButtonProps) {
|
export function Button({ className, ...props }: ButtonProps) {
|
||||||
return <button className={classNames("button", className)} {...props} />;
|
return <button className={classNames("button", className)} {...props} />;
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
.text {
|
.text {
|
||||||
font-size: var(--font-size-regular);
|
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"> {
|
export interface TextProps extends ComponentProps<"span"> {
|
||||||
color?: Color;
|
color?: Color;
|
||||||
lowContrast?: boolean;
|
lowContrast?: boolean;
|
||||||
|
size?: "regular" | "minor";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Text({
|
export function Text({
|
||||||
color = "gray",
|
color = "gray",
|
||||||
lowContrast,
|
lowContrast,
|
||||||
className,
|
className,
|
||||||
|
size = "regular",
|
||||||
...props
|
...props
|
||||||
}: TextProps) {
|
}: TextProps) {
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
className={classNames("text", className)}
|
className={classNames("text", className)}
|
||||||
style={{ color: `var(--${color}-${lowContrast ? 11 : 12})` }}
|
style={{ color: `var(--${color}-${lowContrast ? 11 : 12})` }}
|
||||||
|
data-size={size}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,30 +1,76 @@
|
|||||||
---
|
---
|
||||||
import { CaretRightIcon } from "@radix-ui/react-icons";
|
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 { Button } from "./Button";
|
||||||
import { Text } from "./Text";
|
import { Text } from "./Text";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tool: Tool;
|
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>
|
<style>
|
||||||
.tool-card {
|
.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>
|
</style>
|
||||||
|
|
||||||
<div class="tool-card">
|
<div
|
||||||
<div>
|
class="tool-card"
|
||||||
<div>
|
style={{
|
||||||
<Text>{tool.id}</Text>
|
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
|
||||||
<Text>{tool.id}</Text>
|
}}
|
||||||
|
>
|
||||||
|
<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>
|
</div>
|
||||||
|
|
||||||
<Button>
|
<Button color={tool.button}>
|
||||||
{tool.id}
|
{toolStrings.action}
|
||||||
<CaretRightIcon />
|
<CaretRightIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import locales from "@blitzkit/i18n/locales.json";
|
import locales from "@blitzkit/i18n/locales.json";
|
||||||
import "@radix-ui/colors/amber-dark.css";
|
import "@radix-ui/colors/amber-dark.css";
|
||||||
import type { GetStaticPaths } from "astro";
|
import type { GetStaticPaths } from "astro";
|
||||||
import packageJson from "../../../../../package.json";
|
|
||||||
import HomeHero from "../../components/HomeHero.astro";
|
import HomeHero from "../../components/HomeHero.astro";
|
||||||
import ToolCard from "../../components/ToolCard.astro";
|
import ToolCard from "../../components/ToolCard.astro";
|
||||||
import { tools } from "../../core/tools/tools";
|
import { tools } from "../../core/tools/tools";
|
||||||
@@ -20,10 +19,17 @@ export const getStaticPaths = (() => {
|
|||||||
const { locale } = Astro.props;
|
const { locale } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.cards {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<BaseLayout accent="amber">
|
<BaseLayout accent="amber">
|
||||||
<HomeHero {locale} />
|
<HomeHero {locale} />
|
||||||
|
|
||||||
<h1>blitzkit {packageJson.version}</h1>
|
<div class="cards">
|
||||||
|
{Object.values(tools).map((tool) => <ToolCard {locale} {tool} />)}
|
||||||
{Object.values(tools).map((tool) => <ToolCard {tool} />)}
|
</div>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
Reference in new issue
Block a user