(tokens) add TS generator and re-organize the repo

Add TS Generator which is a lot based on JS Generator.
This commit is contained in:
Nathan Vasse
2023-01-02 12:06:00 +01:00
committed by NathanVss
parent 2876d29025
commit 66e6aad84d
16 changed files with 159 additions and 35 deletions

View File

@@ -6,7 +6,7 @@
"scripts": {
"lint": "eslint . 'src/**/*.{ts,tsx}'",
"dev": "vite",
"build-theme": "cunningham -o src",
"build-theme": "cunningham -o src -g css,ts",
"build": "tsc && vite build",
"preview": "vite preview"
},

View File

@@ -1,6 +1,4 @@
:root {
--c--colors--primary: purple;
--c--colors--secondary: #DA0000;
--c--text--primary: purple;
--c--text--secondary: #DA0000;
}

View File

@@ -0,0 +1 @@
export const tokens = {"colors":{"primary":"purple","secondary":"#DA0000"}};

View File

@@ -20,7 +20,7 @@
flex-direction: column;
align-items: center;
h1 {
h1, h3 {
color: white;
margin-bottom: 40px;
}

View File

@@ -2,12 +2,14 @@ import React from "react";
import ReactDOM from "react-dom/client";
import "./index.scss";
import { Button } from "@openfun/cunningham-react";
import { tokens } from "./cunningham-tokens";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<div className="center">
<h1 className="test">Cunningham Demo.</h1>
<Button />
<h3>Primary color is {tokens.colors.primary}</h3>
</div>
</React.StrictMode>
);