feat(design): add Modernist tokens, theme remap and Archivo font

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 18:55:02 +08:00
co-authored by Claude Haiku 4.5
parent 106136e902
commit 8701d24c6c
6 changed files with 225 additions and 41 deletions
+57
View File
@@ -0,0 +1,57 @@
import { describe, it, expect } from 'vitest'
import { readFileSync } from 'fs'
import path from 'path'
const css = readFileSync(path.resolve(__dirname, '../../app/globals.css'), 'utf8')
describe('Modernist tokens in globals.css', () => {
it.each([
['--color-bg', '#f3f2f2'],
['--color-surface', '#eae9e9'],
['--color-text', '#201e1d'],
['--color-accent', '#ec3013'],
['--color-accent-700', '#ae1800'],
['--color-neutral-900', '#2d2b2b'],
])('declares %s as %s', (name, value) => {
expect(css).toMatch(new RegExp(`${name}:\\s*${value}`, 'i'))
})
it.each(['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'])('zeroes --radius-%s', size => {
expect(css).toMatch(new RegExp(`--radius-${size}:\\s*0px`))
})
it('zeroes the bare --radius used by the plain rounded class', () => {
expect(css).toMatch(/--radius:\s*0px/)
})
it('has no stray comment terminator before @theme', () => {
const head = css.slice(0, css.indexOf('@theme'))
expect(head.match(/\*\//g)?.length).toBe(head.match(/\/\*/g)?.length)
})
it('remaps the gray ramp onto the neutral ramp', () => {
expect(css).toMatch(/--color-gray-100:\s*var\(--color-neutral-200\)/)
expect(css).toMatch(/--color-gray-900:\s*var\(--color-text\)/)
})
it('remaps the blue ramp onto the accent ramp', () => {
expect(css).toMatch(/--color-blue-600:\s*var\(--color-accent\)/)
expect(css).toMatch(/--color-blue-700:\s*var\(--color-accent-700\)/)
})
it('maps shadows onto the Modernist elevation tokens', () => {
expect(css).toMatch(/--shadow-2xl:\s*var\(--shadow-lg\)/)
})
it('uses Archivo through the next/font variable', () => {
expect(css).toMatch(/--font-sans:\s*var\(--font-archivo\)/)
})
it('has no dark mode block', () => {
expect(css).not.toContain('prefers-color-scheme')
})
it('styles keyboard focus with the 2px accent ring', () => {
expect(css).toMatch(/:focus-visible\s*\{[^}]*outline:\s*2px solid var\(--color-accent\)/)
})
})