diff --git a/apps/demo/.eslintignore b/apps/demo/.eslintignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/apps/demo/.eslintignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/apps/demo/.eslintrc.json b/apps/demo/.eslintrc.json new file mode 100644 index 0000000..9f51ce7 --- /dev/null +++ b/apps/demo/.eslintrc.json @@ -0,0 +1,12 @@ +{ + "root": true, + "extends": [ + "custom" + ], + "parserOptions": { + "project": [ + "./tsconfig.json", + "./tsconfig.node.json" + ] + } +} \ No newline at end of file diff --git a/apps/demo/cunningham.cjs b/apps/demo/cunningham.cjs new file mode 100644 index 0000000..3474d17 --- /dev/null +++ b/apps/demo/cunningham.cjs @@ -0,0 +1,7 @@ +module.exports = { + theme: { + colors: { + primary: 'purple' + }, + }, +}; diff --git a/apps/demo/index.html b/apps/demo/index.html new file mode 100644 index 0000000..82637e1 --- /dev/null +++ b/apps/demo/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/apps/demo/package.json b/apps/demo/package.json new file mode 100644 index 0000000..ee7096b --- /dev/null +++ b/apps/demo/package.json @@ -0,0 +1,29 @@ +{ + "name": "cunningham-demo", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "lint": "eslint . 'src/**/*.{ts,tsx}'", + "dev": "vite", + "build-theme": "cunningham -o src", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@openfun/cunningham-react": "*", + "@openfun/cunningham-tokens": "*", + "@openfun/typescript-configs": "*", + "@types/react": "18.0.25", + "@types/react-dom": "18.0.9", + "@vitejs/plugin-react": "2.2.0", + "react": "18.2.0", + "react-dom": "18.2.0", + "sass": "1.56.1", + "typescript": "4.9.3", + "vite": "3.2.4" + }, + "engines": { + "node": ">=16.0.0" + } +} diff --git a/apps/demo/public/vite.svg b/apps/demo/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/apps/demo/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/demo/src/cunningham-tokens.css b/apps/demo/src/cunningham-tokens.css new file mode 100644 index 0000000..ffc8101 --- /dev/null +++ b/apps/demo/src/cunningham-tokens.css @@ -0,0 +1,6 @@ +:root { + --c--colors--primary: purple; + --c--colors--secondary: #DA0000; + --c--text--primary: purple; + --c--text--secondary: #DA0000; +} \ No newline at end of file diff --git a/apps/demo/src/index.scss b/apps/demo/src/index.scss new file mode 100644 index 0000000..0035f57 --- /dev/null +++ b/apps/demo/src/index.scss @@ -0,0 +1,27 @@ +@import "cunningham-tokens"; +@import "@openfun/cunningham-react/style"; + +:root { + font-family: Roboto, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + color: var(--c--colors--primary); + background-color: #242424; + height: 100vh; + display: flex; + align-items: center; + justify-content: center; +} + + +.center { + display: flex; + flex-direction: column; + align-items: center; + + h1 { + color: white; + margin-bottom: 40px; + } +} \ No newline at end of file diff --git a/apps/demo/src/main.tsx b/apps/demo/src/main.tsx new file mode 100644 index 0000000..81fd1fb --- /dev/null +++ b/apps/demo/src/main.tsx @@ -0,0 +1,13 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.scss"; +import { Button } from "@openfun/cunningham-react"; + +ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( + +
+

Cunningham Demo.

+
+
+); diff --git a/apps/demo/src/vite-env.d.ts b/apps/demo/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/apps/demo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/apps/demo/tsconfig.json b/apps/demo/tsconfig.json new file mode 100644 index 0000000..88c9b8c --- /dev/null +++ b/apps/demo/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@openfun/typescript-configs/react.json", + "compilerOptions": { + "noEmit": true, + }, + "include": ["src"], + "exclude": ["node_modules","dist"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/apps/demo/tsconfig.node.json b/apps/demo/tsconfig.node.json new file mode 100644 index 0000000..b8afcc8 --- /dev/null +++ b/apps/demo/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": [ + "vite.config.ts" + ] +} diff --git a/apps/demo/vite.config.ts b/apps/demo/vite.config.ts new file mode 100644 index 0000000..1770860 --- /dev/null +++ b/apps/demo/vite.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], + server: { + host: true, + port: 3200, + hmr: { + port: 3201, + }, + }, +});