feat(design-system): add Tailwind 4 @theme tokens, fonts, and completeness tests
- Load Fraunces, DM Sans, DM Mono via Google Fonts preconnect in app.html - Define all design tokens in @theme block: neutrals, green/yellow/blue/ purple/orange scales, spacing (--space-1..20), radii, shadows, button base - Note --green-dark as button background (--green fails WCAG AA with white) - Add @types/node for Node fs/path usage in design-system tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #31.
This commit is contained in:
57
frontend/src/lib/design-system/tokens.test.ts
Normal file
57
frontend/src/lib/design-system/tokens.test.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const css = readFileSync(resolve(__dirname, '../../app.css'), 'utf-8');
|
||||
|
||||
const requiredTokens = [
|
||||
// Fonts
|
||||
'--font-display',
|
||||
'--font-sans',
|
||||
'--font-mono',
|
||||
// Neutrals
|
||||
'--color-page',
|
||||
'--color-surface',
|
||||
'--color-subtle',
|
||||
'--color-border',
|
||||
'--color-text',
|
||||
'--color-text-muted',
|
||||
// Green scale
|
||||
'--green-tint',
|
||||
'--green-light',
|
||||
'--green',
|
||||
'--green-dark',
|
||||
'--green-deeper',
|
||||
// Yellow scale
|
||||
'--yellow-tint',
|
||||
'--yellow-light',
|
||||
'--yellow',
|
||||
'--yellow-dark',
|
||||
'--yellow-text',
|
||||
// Status
|
||||
'--color-error',
|
||||
// Spacing
|
||||
'--space-1',
|
||||
'--space-4',
|
||||
'--space-8',
|
||||
'--space-12',
|
||||
'--space-16',
|
||||
'--space-20',
|
||||
// Radii
|
||||
'--radius-xs',
|
||||
'--radius-sm',
|
||||
'--radius-md',
|
||||
'--radius-lg',
|
||||
'--radius-xl',
|
||||
'--radius-full',
|
||||
// Shadows
|
||||
'--shadow-card',
|
||||
'--shadow-raised',
|
||||
'--shadow-overlay'
|
||||
];
|
||||
|
||||
describe('design token completeness', () => {
|
||||
it.each(requiredTokens)('%s is defined in app.css', (token) => {
|
||||
expect(css).toContain(token);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user