mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 15:52:55 +01:00
feat: more accents
This commit is contained in:
1 parent
d08b537721
commit
56ca4dcc61
11 files changed
+114
-12
No files matched your search
@@ -1,4 +1,5 @@
|
||||
---
|
||||
import "@radix-ui/colors/amber-dark.css";
|
||||
import {
|
||||
createProgram,
|
||||
displayPartsToString,
|
||||
@@ -43,7 +44,7 @@ for (const fullPath in globbed) {
|
||||
paths.sort((a, b) => a.path.localeCompare(b.path));
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<BaseLayout accent="amber">
|
||||
<h1>api</h1>
|
||||
|
||||
{
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
---
|
||||
import HomeHero from "../components/HomeHero.astro";
|
||||
import "@radix-ui/colors/amber-dark.css";
|
||||
import packageJson from "../../../../package.json";
|
||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<HomeHero />
|
||||
<BaseLayout accent="amber">
|
||||
<!-- <HomeHero /> -->
|
||||
|
||||
<!-- <h1>blitzkit {packageJson.version}</h1>
|
||||
<h1>blitzkit {packageJson.version}</h1>
|
||||
|
||||
<p><a href="/tanks">/tanks</a></p>
|
||||
|
||||
<p><a href="/api">/api</a></p> -->
|
||||
<p><a href="/api">/api</a></p>
|
||||
</BaseLayout>
|
||||
@@ -0,0 +1,35 @@
|
||||
import * as colors from "@radix-ui/colors";
|
||||
import type { APIContext, GetStaticPaths } from "astro";
|
||||
|
||||
const ignoreEndings = ["A", "P3", "Dark", "DarkA", "DarkP3"] as const;
|
||||
|
||||
const filtered = Object.keys(colors).filter(
|
||||
(name) =>
|
||||
!ignoreEndings.some((ending) => name.endsWith(ending)) &&
|
||||
name !== "__esModule"
|
||||
);
|
||||
|
||||
export const getStaticPaths = (() => {
|
||||
return filtered.map((accent) => ({
|
||||
params: { accent },
|
||||
}));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
export type Color = Exclude<
|
||||
keyof typeof colors,
|
||||
`${string}${(typeof ignoreEndings)[number]}` | "__esModule"
|
||||
>;
|
||||
|
||||
export async function GET({ params }: APIContext<{}, { accent: Color }>) {
|
||||
const palette = colors[`${params.accent}Dark`];
|
||||
let content = ":root{";
|
||||
|
||||
for (const key in palette) {
|
||||
const dashedKey = key.replace(/([a-zA-Z])(\d+)/, "$1-$2");
|
||||
content += `--${dashedKey}:${palette[key as keyof typeof palette]};`;
|
||||
}
|
||||
|
||||
content += "}";
|
||||
|
||||
return new Response(content);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
import "@radix-ui/colors/violet-dark.css";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
@@ -16,6 +17,6 @@ export const getStaticPaths = (async () => {
|
||||
const { id } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<BaseLayout accent="violet">
|
||||
<Page {id} client:load />
|
||||
</BaseLayout>
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
import "@radix-ui/colors/violet-dark.css";
|
||||
import { api } from "../../core/api/dynamic";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
const tanksList = await api.tanks();
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<BaseLayout accent="violet">
|
||||
<h1>tanks</h1>
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user