1
- <img src =" ./public /header.svg" width =" 100% " alt =" css-in-readme " >
1
+ <img src =" https://storybook.tetrisly.com /header.svg" width =" 100% " alt =" css-in-readme " >
2
2
3
3
# Tetrisly React
4
4
@@ -15,52 +15,138 @@ We've desided to use `xstyled` for styling our components. If you are interested
15
15
16
16
## Installation
17
17
18
- Install tetrisly-react with npm (you can do the same with yarn, pnpm or any other package manager)
18
+ Install ` tetrisly-react`` with npm (you can do the same with yarn, pnpm or any other package manager)
19
19
20
20
``` bash
21
21
npm install @virtuslab/tetrisly-react
22
22
```
23
23
24
+ and dependencies:
25
+
26
+ ``` bash
27
+ npm install styled-components @xstyled/styled-components
28
+ ```
29
+
24
30
## Setup
25
31
32
+ ### TetrislyProvider
33
+
26
34
After installing the package, you need to wrap your application in the ` TetrislyProvider ` component. This will provide the theme and other context to your application.
27
35
28
- ``` typescript
36
+ ``` jsx
29
37
import { TetrislyProvider } from ' @virtuslab/tetrisly-react' ;
30
38
31
39
function App () {
32
40
return (
33
41
< TetrislyProvider>
34
42
< YourApp / >
35
43
< / TetrislyProvider>
36
- )
44
+ );
37
45
}
38
46
```
39
47
40
48
TetrislyProvider accepts optional prop ` theme ` which can be used to override default theme.
41
49
42
- You can check out how this object looks like here: [ Tetrisly Theme] ( src/theme/theme.ts )
43
-
44
- ``` typescript
50
+ ``` jsx
45
51
import { TetrislyProvider } from ' @virtuslab/tetrisly-react' ;
46
52
47
53
function App () {
48
54
return (
49
- < TetrislyProvider theme = {{ colors : { primary : ' red' } }}>
55
+ < TetrislyProvider
56
+ theme= {{
57
+ colors: {
58
+ ' $color-semantic-brand--4' : th .color (' $color-raspberry--4' ),
59
+ ' $color-semantic-brand--3' : th .color (' $color-raspberry--3' ),
60
+ ' $color-semantic-brand--2' : th .color (' $color-raspberry--2' ),
61
+ ' $color-semantic-brand--1' : th .color (' $color-raspberry--1' ),
62
+ ' $color-semantic-brand-0' : th .color (' $color-raspberry-0' ),
63
+ ' $color-semantic-brand-+1' : th .color (' $color-raspberry-+1' ),
64
+ ' $color-semantic-brand-+2' : th .color (' $color-raspberry-+2' ),
65
+ ' $color-semantic-brand-+3' : th .color (' $color-raspberry-+3' ),
66
+ ' $color-semantic-brand-+4' : th .color (' $color-raspberry-+4' ),
67
+ ' $color-semantic-brand-+5' : th .color (' $color-raspberry-+5' ),
68
+ ' $color-semantic-brand-+6' : th .color (' $color-raspberry-+6' ),
69
+ ' $color-semantic-brand-+7' : th .color (' $color-raspberry-+7' ),
70
+ ' $color-semantic-brand-+8' : th .color (' $color-raspberry-+8' ),
71
+ },
72
+ }}
73
+ >
50
74
< YourApp / >
51
75
< / TetrislyProvider>
52
- )
76
+ );
53
77
}
54
78
```
55
79
56
- ## Usage/Examples
80
+ ### Default theme
57
81
58
- ``` typescript
59
- import { Button } from ' @virtuslab/tetrisly-react ' ;
82
+ Our default theme contains all of fundamental Tetrisly Design Tokens, you can use it with ` xstyled ` props to easy set up
83
+ your design. See ` tet.* ` utility [ example of use ] ( #tet-utility ) .
60
84
61
- function App() {
62
- return <Button label = " Hello Tetrisly" />
63
- }
85
+ Here you can see the
86
+ [ default theme] ( https://github.com/VirtusLab/@tetrisly/react/blob/development/src/theme/defaultTheme.ts ) or a complete
87
+ list of theme options.
88
+
89
+ ### Default font
90
+
91
+ Tetrisly uses [ Inter] ( https://fonts.google.com/specimen/Inter ) font as default. To add it to your app you should link it
92
+ in your root ` .html ` file:
93
+
94
+ ``` html
95
+ <link rel =" preconnect" href =" https://fonts.googleapis.com" />
96
+ <link rel =" preconnect" href =" https://fonts.gstatic.com" crossorigin />
97
+ <link
98
+ href =" https://fonts.googleapis.com/css2?family=Inter:wght@400;450;600&display=swap"
99
+ rel =" stylesheet"
100
+ />
101
+ ```
102
+
103
+ ## ` tet.* ` utility
104
+
105
+ ` tet ` function is our extension of xstyled ` x.* ` utility. Both has the same API, but we will add some extra features in
106
+ near future. You can read more [ here] ( https://xstyled.dev/docs/utility-props/ ) .
107
+
108
+ ### Example of use
109
+
110
+ ``` jsx
111
+ import {
112
+ TetrislyProvider ,
113
+ Button ,
114
+ theme ,
115
+ tet ,
116
+ } from ' @virtuslab/tetrisly-react' ;
117
+
118
+ const App = () => (
119
+ < TetrislyProvider>
120
+ < tet .div
121
+ display= " flex"
122
+ justifyContent= " center"
123
+ alignItems= " center"
124
+ h= " 100vh"
125
+ >
126
+ < tet .div >
127
+ < tet .h1
128
+ textAlign= " center"
129
+ mb= " $dimension-200"
130
+ text= " $typo-header-4xLarge"
131
+ color= " $color-content-primary"
132
+ >
133
+ Hello world!
134
+ < / tet .h1 >
135
+ < tet .div display= " flex" justifyContent= " center" alignItems= " center" >
136
+ < a
137
+ href= " https://storybook.tetrisly.com"
138
+ target= " _blank"
139
+ rel= " noreferrer"
140
+ >
141
+ < Button label= " Go to Storybook" appearance= " primary" / >
142
+ < / a>
143
+ < / tet .div >
144
+ < / tet .div >
145
+ < / tet .div >
146
+ < / TetrislyProvider>
147
+ );
148
+
149
+ export default App ;
64
150
```
65
151
66
152
## Run Locally
@@ -99,12 +185,19 @@ To run tests, run the following command
99
185
100
186
## Documentation
101
187
102
- <img src = " ./public/logo_docs .svg" />
188
+ <img src =" https://storybook.tetrisly.com/logo-docs .svg" />
103
189
104
190
If you want to dive deeper into the components Tetrisly offers, check out our official documentation: [ Tetrisly Docs] ( https://docs.tetrisly.com/ )
105
191
106
192
You can also check out our Storybook, which is our Documentation for React components (now in progress): [ Tetrisly Storybook] ( https://virtuslab.github.io/tetrisly-react/?path=/docs/alertbanner--docs )
107
193
194
+ ### Useful links
195
+
196
+ - [ Tetrisly Storybook] ( https://storybook.tetrisly.com/ )
197
+ - [ Tetrisly Figma Docs] ( https://docs.tetrisly.com/ )
198
+ - [ Tetrisly Figma Preview] ( https://tetrisly.com/preview )
199
+ - [ xstyled Docs] ( https://xstyled.dev/ )
200
+
108
201
## Getting Help
109
202
110
203
If at any point you need help, feel lost, or have some feedback for us, you can create issues on our GitHub repository, or reach out to us on out Discord Server: [ Tetrisly Discord] ( https://discord.gg/MPefZwUZUu )
@@ -116,3 +209,9 @@ If you want to share with us your thoughts on Tetrisly, or showcase what you hav
116
209
## License
117
210
118
211
We are using the [ Apache License 2.0] ( https://choosealicense.com/licenses/apache-2.0/ ) for our library of components
212
+
213
+ ## VirtusLab
214
+
215
+ <img src =" https://storybook.tetrisly.com/logo-virtuslab.svg " />
216
+
217
+ Meet [ VirtusLab] ( https://virtuslab.com/ ) , the visionary team behind Tetrisly for React and the Tetrisly design system. Trusted by clients, they excel in product design, design systems and front-end engineering, creating mission-critical solutions across the product lifecycle.
0 commit comments