Prepare product layout and reusable Flutter theme
Relocate the existing Astro website and preserve its assets and hosting configuration. Add the consumer/backend scaffold and themed Flutter package with consumer tests. Related to #1.
This commit is contained in:
1 parent
ef65a40213
commit
d9318053e8
46 files changed
+703
-1
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
const tokens = JSON.parse(
|
||||
readFileSync(new URL('../design/tokens.json', import.meta.url), 'utf8'),
|
||||
);
|
||||
const kebab = (name) => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
||||
const colors = Object.entries(tokens.colors);
|
||||
writeFileSync(
|
||||
new URL('../src/styles/tokens.css', import.meta.url),
|
||||
`/* Generated by npm run tokens. Edit design/tokens.json. */\n:root {\n${colors.map(([k, v]) => ` --${kebab(k)}: ${v};`).join('\n')}\n --radius: ${tokens.website.radius.card}px;\n --font-family: '${tokens.typography.family}', Arial, sans-serif;\n}\n`,
|
||||
);
|
||||
writeFileSync(
|
||||
new URL('../flutter/brand_palette.dart', import.meta.url),
|
||||
`// Generated brand palette reference. Optional for the Flutter application.\n// This is not an application theme: choose component styling independently.\nimport 'dart:ui';\n\nabstract final class SxchngeBrand {\n${colors.map(([k, v]) => ` static const ${k} = Color(0xFF${v.slice(1).toUpperCase()});`).join('\n')}\n static const fontFamily = '${tokens.typography.family}';\n}\n`,
|
||||
);
|
||||
Reference in new issue
Block a user