File tree 1 file changed +21
-7
lines changed
1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,17 @@ MistCSS is a new, better and faster way to write visual components. ~~CSS-in-JS~
8
8
9
9
All major frameworks are supported.
10
10
11
- ## Write your component in CSS only
11
+ ## 1. Write your component in CSS only
12
12
13
- This CSS is the only code you'll write for your component.
13
+ ` ./src/Button.mist.css `
14
14
15
- ``` css title="Button.mist.css"
15
+ ``` css
16
16
@scope (button.custom-button) {
17
17
:scope {
18
18
background : black ;
19
19
color : white ;
20
20
21
- /* Define component's props directly in your CSS 👇 */
21
+ /* 👇 Define component's props directly in your CSS */
22
22
&[data-variant ="primary "] {
23
23
background : blue ;
24
24
}
@@ -30,13 +30,27 @@ This CSS is the only code you'll write for your component.
30
30
}
31
31
```
32
32
33
- ## Get a type-safe component without writing TypeScript
33
+ ## 2. Run MistCSS codegen
34
34
35
- ``` jsx title="App.tsx"
35
+ ``` shell
36
+ mistcss ./src --target=react --watch
37
+ # It will create ./src/Button.mist.tsx
38
+ ```
39
+
40
+ ## 3. Get a type-safe component without writing TypeScript
41
+
42
+ ` ./src/App.tsx `
43
+
44
+ ``` jsx
36
45
import { CustomButton } from ' ./Button.mist'
37
46
38
47
export const App = () => (
39
- < CustomButton variant= " primary" > Save< / CustomButton>
48
+ <>
49
+ < CustomButton variant= " primary" > Save< / CustomButton>
50
+
51
+ {/* TypeScript will catch the error */ }
52
+ < CustomButton variant= " tertiary" > Cancel< / CustomButton>
53
+ < / >
40
54
)
41
55
```
42
56
You can’t perform that action at this time.
0 commit comments