feat: tanks section

This commit is contained in:
TrèsAbhi committed 2026-01-31 22:54:00 -06:00
1 parent 81877f5abd
commit 4a9fc65e71
9 files changed
+66 -33

No files matched your search

+2 -6
View File
@@ -80,7 +80,8 @@
"home": { "home": {
"search": "Search tanks, players, avatars...", "search": "Search tanks, players, avatars...",
"credit": "by TrèsAbhi" "credit": "by TrèsAbhi",
"tanks": "Tanks"
}, },
"avatars": { "avatars": {
@@ -100,10 +101,5 @@
"navbar": { "navbar": {
"home": "Home", "home": "Home",
"settings": "Settings" "settings": "Settings"
},
"recent": {
"title": "Recent",
"no_recent": "Your recently viewed pages will appear here."
} }
} }
@@ -0,0 +1 @@
export function Scroller() {}
@@ -1,7 +1,7 @@
.section { .section {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: var(--space-4); padding: var(--space-5);
.content { .content {
flex: 1; flex: 1;
@@ -1,6 +1,6 @@
import type { ComponentProps } from "react"; import type { ComponentProps } from "react";
import { classNames } from "../../core/ui/classNames"; import { classNames } from "../../core/ui/classNames";
import "./index.css"; import styles from "./index.module.css";
export interface SectionProps extends ComponentProps<"div"> { export interface SectionProps extends ComponentProps<"div"> {
first?: boolean; first?: boolean;
@@ -10,10 +10,10 @@ export function Section({ className, children, ...props }: SectionProps) {
return ( return (
<div <div
data-first={props.first} data-first={props.first}
className={classNames("section", className)} className={classNames(styles.section, className)}
{...props} {...props}
> >
<div className="content">{children}</div> <div className={styles.content}>{children}</div>
</div> </div>
); );
} }
@@ -1,7 +1,19 @@
--- ---
import { api } from "../core/api/dynamic";
import { tools } from "../core/tools/tools";
import { Heading } from "./Heading"; import { Heading } from "./Heading";
import { Section } from "./Section"; import { Section } from "./Section";
import { TankCard } from "./TankCard"; import { TankCard } from "./TankCard";
import ToolCard from "./ToolCard.astro";
import ToolsWrapper from "./ToolsWrapper.astro";
interface Props {
locale: string;
}
const { locale } = Astro.props;
const strings = await api.strings(locale);
const popular = [ const popular = [
"Concept 1B", "Concept 1B",
@@ -18,10 +30,16 @@ const popular = [
--- ---
<style> <style>
.tanks { .title {
overflow-x: scroll; margin-bottom: var(--space-3);
}
.asd { .tanks {
/* overflow-x: scroll; */
overflow-x: hidden;
z-index: 1;
.content {
display: flex; display: flex;
gap: 2rem; gap: 2rem;
@@ -30,11 +48,18 @@ const popular = [
</style> </style>
<Section> <Section>
<Heading size="2">Popular tanks</Heading> <Heading size="2" className="title">{strings.home.tanks}</Heading>
<div class="tanks"> <div class="tanks">
<div class="asd"> <div class="content">
{popular.map((tank) => <TankCard {tank} />)} {popular.map((tank) => <TankCard {tank} />)}
</div> </div>
</div> </div>
<ToolCard gradient {locale} tool={tools.tanks} />
<ToolsWrapper>
<ToolCard {locale} tool={tools.compare} />
<ToolCard {locale} tool={tools.performance} />
</ToolsWrapper>
</Section> </Section>
@@ -9,9 +9,11 @@ import { Text } from "./Text";
interface Props { interface Props {
tool: Tool; tool: Tool;
locale: string; locale: string;
gradient?: boolean;
} }
const { tool, locale } = Astro.props; const { tool, locale, gradient } = Astro.props;
const strings = await api.strings(locale); const strings = await api.strings(locale);
const toolStrings = strings.tools[tool.id as keyof typeof strings.tools]; const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
--- ---
@@ -29,9 +31,8 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
background-position: center; background-position: center;
overflow: hidden; overflow: hidden;
&[data-significant="true"] { &[data-gradient="true"] {
grid-column: 1 / -1; height: 10rem;
height: 15rem;
} }
.poster { .poster {
@@ -39,6 +40,13 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
background-size: cover; background-size: cover;
background-position: center; background-position: center;
.gradient {
width: 100%;
height: 100%;
background: linear-gradient(var(--gray-1), transparent);
}
} }
.info { .info {
@@ -64,7 +72,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
style={{ style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`, backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}} }}
data-significant={tool.significant} data-gradient={gradient}
> >
<div <div
class="poster" class="poster"
@@ -72,6 +80,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
backgroundImage: `url(/assets/tools/${tool.id}.webp)`, backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
}} }}
> >
{gradient && <div class="gradient" />}
</div> </div>
<div class="info"> <div class="info">
@@ -0,0 +1,11 @@
<style>
.tools {
display: grid;
gap: var(--space-4);
grid-template-columns: repeat(2, 1fr);
}
</style>
<div class="tools">
<slot />
</div>
@@ -3,7 +3,6 @@ import type { Color } from "../ui/color";
export interface Tool { export interface Tool {
id: string; id: string;
significant?: boolean;
accent: Color; accent: Color;
banner_background_position: "top" | "center" | "bottom"; banner_background_position: "top" | "center" | "bottom";
} }
@@ -12,7 +11,6 @@ export const tools: Record<string, Tool> = {
tanks: { tanks: {
id: "tanks", id: "tanks",
significant: true,
accent: "plum", accent: "plum",
banner_background_position: "top", banner_background_position: "top",
}, },
@@ -6,6 +6,7 @@ import HomeHero from "../../components/HomeHero.astro";
import { Section } from "../../components/Section"; import { Section } from "../../components/Section";
import TanksCard from "../../components/TanksCard.astro"; import TanksCard from "../../components/TanksCard.astro";
import ToolCard from "../../components/ToolCard.astro"; import ToolCard from "../../components/ToolCard.astro";
import ToolsWrapper from "../../components/ToolsWrapper.astro";
import { tools } from "../../core/tools/tools"; import { tools } from "../../core/tools/tools";
import BaseLayout from "../../layouts/BaseLayout.astro"; import BaseLayout from "../../layouts/BaseLayout.astro";
@@ -21,14 +22,6 @@ export const getStaticPaths = (() => {
const { locale } = Astro.props; const { locale } = Astro.props;
--- ---
<style>
.tools {
display: grid;
gap: var(--space-4);
grid-template-columns: repeat(2, 1fr);
}
</style>
<BaseLayout {locale} accent="amber"> <BaseLayout {locale} accent="amber">
<HomeHero {locale} /> <HomeHero {locale} />
@@ -38,11 +31,11 @@ const { locale } = Astro.props;
<RecentItems {locale} skeleton slot="fallback" /> <RecentItems {locale} skeleton slot="fallback" />
</RecentItems> --> </RecentItems> -->
<TanksCard /> <TanksCard {locale} />
<Section> <Section>
<div class="tools"> <ToolsWrapper>
{Object.values(tools).map((tool) => <ToolCard {locale} {tool} />)} {Object.values(tools).map((tool) => <ToolCard {locale} {tool} />)}
</div> </ToolsWrapper>
</Section> </Section>
</BaseLayout> </BaseLayout>