mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: avatars search bar ui
This commit is contained in:
1 parent
6ec7a50320
commit
63ce327458
11 files changed
+79
-39
No files matched your search
@@ -46,5 +46,9 @@
|
||||
"home": {
|
||||
"search": "Search tanks, players, tools...",
|
||||
"credit": "by TrèsAbhi"
|
||||
},
|
||||
|
||||
"avatars": {
|
||||
"search": "Search avatars..."
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,16 @@
|
||||
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
||||
import { useStrings } from "../../hooks/useStrings";
|
||||
import { TextField } from "../TextField";
|
||||
import "./index.css";
|
||||
|
||||
export function AvatarControls() {
|
||||
const strings = useStrings();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<TextField placeholder={strings.avatars.search}>
|
||||
<MagnifyingGlassIcon />
|
||||
</TextField>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<style>
|
||||
.section {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 0 var(--space-4);
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
max-width: var(--page-width);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="section">
|
||||
<div class="content">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
.section {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 0 var(--space-4);
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
max-width: var(--page-width);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import type { ComponentProps } from "react";
|
||||
import { classNames } from "../../core/ui/classNames";
|
||||
import "./index.css";
|
||||
|
||||
export function Section({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: ComponentProps<"div">) {
|
||||
return (
|
||||
<div className={classNames("section", className)} {...props}>
|
||||
<div className="content">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
&[data-has-icon="true"] {
|
||||
padding-left: var(--space-3);
|
||||
|
||||
input {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
@@ -38,6 +42,7 @@
|
||||
font-size: inherit;
|
||||
font-weight: medium;
|
||||
padding: var(--space-3) 0;
|
||||
padding-left: var(--space-4);
|
||||
|
||||
color: var(--gray-12);
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
---
|
||||
|
||||
<style>
|
||||
.tool-hero {
|
||||
.tool-banner {
|
||||
background-size: cover;
|
||||
margin-bottom: calc(var(--space-5) - var(--space-4));
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
@@ -63,7 +64,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
</style>
|
||||
|
||||
<div
|
||||
class="tool-hero"
|
||||
class="tool-banner"
|
||||
style={{
|
||||
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
|
||||
backgroundPosition: tool.banner_background_position ?? "top",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useMemo } from "react";
|
||||
import { AvatarCard } from "../../../components/AvatarCard";
|
||||
import { AvatarControls } from "../../../components/AvatarControls";
|
||||
import { IncrementalLoader } from "../../../components/IncrementalLoader";
|
||||
import { Section } from "../../../components/Section";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
import { useAwait } from "../../../hooks/useAwait";
|
||||
import { useGameStrings } from "../../../hooks/useGameStrings";
|
||||
@@ -75,13 +77,21 @@ function Content({}: ContentProps) {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="avatars">
|
||||
<IncrementalLoader
|
||||
initial={40}
|
||||
intermediate={10}
|
||||
data={ordered}
|
||||
Component={AvatarCard}
|
||||
/>
|
||||
</div>
|
||||
<>
|
||||
<Section>
|
||||
<AvatarControls />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<div className="avatars">
|
||||
<IncrementalLoader
|
||||
initial={40}
|
||||
intermediate={10}
|
||||
data={ordered}
|
||||
Component={AvatarCard}
|
||||
/>
|
||||
</div>
|
||||
</Section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
---
|
||||
import Section from "../../../components/Section.astro";
|
||||
import ToolBanner from "../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../core/tools/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
@@ -21,9 +20,7 @@ const { locale } = Astro.props;
|
||||
<BaseLayout {locale} accent="gold">
|
||||
<ToolBanner {locale} tool={tools.avatars} slot="pre-app" />
|
||||
|
||||
<Section>
|
||||
<Page {locale} client:only="react">
|
||||
<Page {locale} skeleton slot="fallback" />
|
||||
</Page>
|
||||
</Section>
|
||||
<Page {locale} client:only="react">
|
||||
<Page {locale} skeleton slot="fallback" />
|
||||
</Page>
|
||||
</BaseLayout>
|
||||
@@ -4,7 +4,7 @@ import "@radix-ui/colors/amber-dark.css";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import ColorScale from "../../components/ColorScale.astro";
|
||||
import HomeHero from "../../components/HomeHero.astro";
|
||||
import Section from "../../components/Section.astro";
|
||||
import Section from "../../components/Section";
|
||||
import ToolCard from "../../components/ToolCard.astro";
|
||||
import { tools } from "../../core/tools/tools";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
Reference in new issue
Block a user