pentatrion-design 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,40 +1,171 @@
1
- # Pentatrion Design System
1
+ # [Pentatrion Design System](https://storybook.lonlat.pentatrion.com)
2
2
 
3
- ## Installation
3
+ <a href="https://storybook.lonlat.pentatrion.com">
4
+ <img src="https://raw.githubusercontent.com/lhapaipai/lonlat/main/extra/assets/public/graphics/screenshots/storybook.jpg" alt="Pentatrion design system" />
5
+ </a>
4
6
 
5
- La dépendance `pentatrion-fonts` est optionnelle.
7
+ ## Prérequis
8
+
9
+ Créez un nouveau projet Vite + React + TailwindCSS. [Official doc](https://tailwindcss.com/docs/guides/vite)
6
10
 
7
11
  ```bash
8
- pnpm add pentatrion-design pentatrion-fonts
12
+ pnpm create vite my-app
13
+
14
+ # 1. React
15
+ # 2. TypeScript + SWC
16
+
17
+ cd my-app
18
+
19
+ pnpm add -D tailwindcss postcss autoprefixer postcss-load-config prettier-plugin-tailwindcss
20
+
21
+ # si vous utilisez le composant <input type="range" />
22
+ pnpm add -D postcss-input-range
23
+ ```
24
+
25
+ Supprimer les fichiers inutiles
26
+
9
27
  ```
28
+ .
29
+ ├── src
30
+ │ ├── App.tsx
31
+ │ ├── index.css
32
+ │ ├── main.tsx
33
+ │ └── vite-env.d.ts
34
+ ├── tailwind.config.js
35
+ └── postcss.config.js
36
+ ```
37
+
38
+ Créer un fichier `tailwind.config.js` et `postcss.config.js`.
10
39
 
11
40
  ```js
12
41
  // tailwind.config.js
13
- import pentatrionTw from "pentatrion-design";
14
42
 
15
43
  /** @type {import('tailwindcss').Config} */
16
44
  export default {
17
45
  content: [
18
- "./node_modules/pentatrion-design/dist/*.js",
46
+ "./index.html",
47
+ "./src/**/*.{js,ts,jsx,tsx}",
19
48
  ],
20
49
  darkMode: ["class"],
21
- plugins: [pentatrionTw],
50
+ };
51
+
52
+
53
+ // postcss.config.js
54
+ /** @type {import("postcss-load-config").Config} */
55
+ export default {
56
+ plugins: {
57
+ "tailwindcss/nesting": {},
58
+ tailwindcss: {},
59
+
60
+ // si vous utilisez le composant <input type="range" />
61
+ // bien le mettre en dernier car tailwind génère du contenu à transformer
62
+ "postcss-input-range": {}
63
+ },
22
64
  };
23
65
  ```
66
+
67
+ Mettre à jour le fichier `src/index.css`
24
68
  ```css
69
+ /* on utilisera des imports pour faciliter l'intégration du design système */
70
+ @import "tailwindcss/base";
71
+ @import "tailwindcss/components";
72
+ @import "tailwindcss/utilities";
73
+ ```
74
+
75
+ ## Installation
76
+
77
+
78
+ ```bash
79
+ pnpm add pentatrion-design
80
+ ```
81
+
82
+ Mettre à jour la configuration de tailwind.
83
+
84
+ ```diff
85
+ // tailwind.config.js
86
+ + import { pentatrionTw } from "pentatrion-design/tailwind";
87
+
88
+ /** @type {import('tailwindcss').Config} */
89
+ export default {
90
+ content: [
91
+ "./index.html",
92
+ "./src/**/*.{js,ts,jsx,tsx}",
93
+ + "./node_modules/pentatrion-design/components/**/*.{ts,tsx}",
94
+ + "./node_modules/pentatrion-design/hooks/**/*.{ts,tsx}",
95
+ + "./node_modules/pentatrion-design/redux/**/*.{ts,tsx}",
96
+ ],
97
+ darkMode: ["class"],
98
+ + plugins: [pentatrionTw],
99
+ };
100
+ ```
101
+
102
+ La dépendance `pentatrion-fonts` est optionnelle.
103
+
104
+ Mettre à jour `src/App.tsx`
105
+ ```tsx
106
+ // import global
107
+ import { Button } from "pentatrion-design";
108
+
109
+ // import minimal
110
+ import { Button } from "pentatrion-design/components/button";
111
+
112
+ import { useState } from "react"
113
+
114
+ function App() {
115
+ const [counter, setCounter] = useState(0);
116
+
117
+ return (
118
+ <div className="flex flex-col gap-2 items-center">
119
+ <h1 className="text-gray-6">Vite + React</h1>
120
+ <Button onClick={() => setCounter(c => c + 1)}>Click me !</Button>
121
+ <p>{counter}</p>
122
+ </div>
123
+ )
124
+ }
125
+
126
+ export default App
127
+ ```
128
+
129
+ L'import minimal `import { Button } from "pentatrion-design/components/button";` est plus contraignant et n'est pas nécessaire si votre projet utilise toutes les dépendances de `pentatrion-design`. si par contre votre projet n'utilise que certains composants et n'utilise pas certains dépendances comme `react-sortablejs` il vaut mieux utiliser l'import `pentatrion-design/components/button`. Cela allégera le build (que notre compilateur fasse du tree shaking ou non).
130
+
131
+ Mettre à jour `src/index.css`
132
+ ```diff
25
133
  /* index.css */
26
134
  @import "tailwindcss/base";
27
- @import "pentatrion-design/src/tailwind/base.css" layer(base);
135
+ + @import "pentatrion-design/tailwind/base.css" layer(base);
28
136
 
29
137
  @import "tailwindcss/components";
30
- @import "pentatrion-design/src/tailwind/components.css" layer(components);
31
- @import "pentatrion-design/src/tailwind/components-input-outline.css" layer(components);
32
- @import "pentatrion-design/src/tailwind/components-resize-area.css" layer(components);
33
- @import "pentatrion-design/src/tailwind/components-step.css" layer(components);
138
+ + @import "pentatrion-design/tailwind/components.css" layer(components);
139
+ + @import "pentatrion-design/tailwind/components-input-outline.css" layer(components);
140
+ + @import "pentatrion-design/tailwind/components-resize-area.css" layer(components);
141
+ + @import "pentatrion-design/tailwind/components-step.css" layer(components);
34
142
 
35
143
  @import "tailwindcss/utilities";
36
- @import "pentatrion-design/src/tailwind/utilities.css" layer(utilities);
37
- @import "pentatrion-design/src/tailwind/utilities-dialog.css" layer(utilities);
144
+ + @import "pentatrion-design/tailwind/utilities.css" layer(utilities);
145
+ + @import "pentatrion-design/tailwind/utilities-dialog.css" layer(utilities);
146
+
147
+ /* Optionel */
148
+ + @import "pentatrion-fonts/fontello-lonlat";
149
+ ```
150
+
151
+
152
+ ## projet sans TypeScript
153
+
154
+ pour faciliter l'expérience de développement, `pentatrion-design` fait référence par défaut aux fichiers TypeScript non compilés. Si votre projet n'utilise pas TypeScript il faudra faire référence au dossier `dist`
155
+
156
+ ```js
157
+ import { Button } from "pentatrion-design/dist";
158
+ ```
159
+
160
+ ## VsCode
161
+
162
+
163
+ Create a `.vscode/settings.json` file
38
164
 
39
- @import "pentatrion-fonts/fontello-lonlat";
165
+ ```json
166
+ {
167
+ "files.associations": {
168
+ "*.css": "tailwindcss"
169
+ }
170
+ }
40
171
  ```