MAESTRO: add frontend design tokens

This commit is contained in:
Mariusz Banach
2026-02-17 23:10:28 +01:00
parent 17e96354df
commit b6a76a836c
3 changed files with 69 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ The hacker-themed dark colour palette (from spec FR-14):
- [x] T003 [P] Create `backend/app/core/config.py` with Pydantic BaseSettings for CORS origins, rate limit thresholds, analysis timeout (30s), and debug flag — all configurable via environment variables
- [x] T004 [P] Create `frontend/src/types/analysis.ts` with TypeScript interfaces: `HeaderInput`, `AnalysisConfig` (test IDs, resolve flag, decode-all flag), `TestResult` (id, name, header, value, analysis, description, severity, status), `AnalysisReport` (results, hopChain, securityAppliances, metadata), `AnalysisProgress` (current test, total, percentage, elapsed). Refer to `.specify/specs/1-web-header-analyzer/data-model.md` for the complete entity definitions
- [x] T005 [P] Create `frontend/src/lib/api-client.ts` — API client abstraction wrapping fetch with base URL from environment, JSON defaults, error handling, and typed response generics. Must support SSE streaming via ReadableStream for the analysis endpoint
- [ ] T006 [P] Create `frontend/src/styles/design-tokens.ts` — centralised design tokens: colours (#1e1e2e background, #282a36 surface, #f8f8f2 text, #ff5555 spam, #ffb86c suspicious, #50fa7b clean, #bd93f9 accent), font families (mono/sans), spacing scale, and border-radius values
- [x] T006 [P] Create `frontend/src/styles/design-tokens.ts` — centralised design tokens: colours (#1e1e2e background, #282a36 surface, #f8f8f2 text, #ff5555 spam, #ffb86c suspicious, #50fa7b clean, #bd93f9 accent), font families (mono/sans), spacing scale, and border-radius values
## Completion

View File

@@ -0,0 +1,25 @@
import { describe, expect, it } from "vitest";
import { colors, fontFamilies, radii, spacing } from "./design-tokens";
describe("design tokens", () => {
it("exposes the expected color palette", () => {
expect(colors).toEqual({
background: "#1e1e2e",
surface: "#282a36",
text: "#f8f8f2",
spam: "#ff5555",
suspicious: "#ffb86c",
clean: "#50fa7b",
accent: "#bd93f9",
info: "#8be9fd",
});
});
it("includes core font, spacing, and radius tokens", () => {
expect(fontFamilies.sans).toContain("var(--font-geist-sans)");
expect(fontFamilies.mono).toContain("var(--font-geist-mono)");
expect(spacing.md).toBe("12px");
expect(radii.md).toBe("8px");
});
});

View File

@@ -0,0 +1,43 @@
export const colors = {
background: "#1e1e2e",
surface: "#282a36",
text: "#f8f8f2",
spam: "#ff5555",
suspicious: "#ffb86c",
clean: "#50fa7b",
accent: "#bd93f9",
info: "#8be9fd",
} as const;
export const fontFamilies = {
sans: "var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif",
mono: "var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, monospace",
} as const;
export const spacing = {
none: "0px",
xs: "4px",
sm: "8px",
md: "12px",
lg: "16px",
xl: "24px",
"2xl": "32px",
"3xl": "48px",
"4xl": "64px",
} as const;
export const radii = {
none: "0px",
sm: "4px",
md: "8px",
lg: "12px",
xl: "16px",
full: "9999px",
} as const;
export const designTokens = {
colors,
fontFamilies,
spacing,
radii,
} as const;