1
1
import React , { CSSProperties } from 'react' ;
2
- import './App.css' ;
3
- import * as Space from './components/Space' ;
2
+ import * as Space from 'react-spaces' ;
4
3
import { Tabs , Menu , Button } from 'antd' ;
5
4
import 'antd/dist/antd.css' ;
6
- import { Centered } from './components/Centered' ;
7
- import { Fixed } from './components/FixedSizeContainer' ;
8
5
import SyntaxHighlighter from 'react-syntax-highlighter' ;
9
6
import './App.scss' ;
10
7
11
8
const darkStyle : CSSProperties = { backgroundColor : '#333' , color : 'white' } ;
12
9
const darkStyleWithPadding : CSSProperties = { ...darkStyle , ...{ padding : 13 } } ;
13
10
14
11
const Description = ( props : string ) => (
15
- < Centered >
12
+ < Space . Centered >
16
13
< strong > { props } </ strong >
17
14
< Space . Info > { info => < div > { info . width } x { info . height } </ div > } </ Space . Info >
18
- </ Centered >
15
+ </ Space . Centered >
19
16
)
20
17
21
18
const App : React . FC = ( ) => {
@@ -34,7 +31,7 @@ const App: React.FC = () => {
34
31
35
32
< h2 > Top level spaces</ h2 >
36
33
37
- < p > There are supposed to be used at the top level of all spaces.</ p >
34
+ < p > These are supposed to be used at the top level of all spaces.</ p >
38
35
39
36
< ul >
40
37
< li >
@@ -111,7 +108,7 @@ const App: React.FC = () => {
111
108
}
112
109
</ SyntaxHighlighter >
113
110
114
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
111
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
115
112
< Space . Left size = { 200 } style = { { backgroundColor : '#eee' } } >
116
113
{ Description ( "Left" ) }
117
114
</ Space . Left >
@@ -121,7 +118,7 @@ const App: React.FC = () => {
121
118
< Space . Right size = { 200 } style = { { backgroundColor : '#eee' } } >
122
119
{ Description ( "Right" ) }
123
120
</ Space . Right >
124
- </ Fixed >
121
+ </ Space . Fixed >
125
122
126
123
< h3 > Top and bottom spaces</ h3 >
127
124
@@ -137,7 +134,7 @@ const App: React.FC = () => {
137
134
}
138
135
</ SyntaxHighlighter >
139
136
140
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
137
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
141
138
< Space . Top size = { 100 } style = { { backgroundColor : '#eee' } } >
142
139
{ Description ( "Top" ) }
143
140
</ Space . Top > t5 cf
@@ -147,7 +144,7 @@ const App: React.FC = () => {
147
144
< Space . Bottom size = { 100 } style = { { backgroundColor : '#eee' } } >
148
145
{ Description ( "Bottom" ) }
149
146
</ Space . Bottom >
150
- </ Fixed >
147
+ </ Space . Fixed >
151
148
152
149
< h2 > Resizable spaces</ h2 >
153
150
@@ -172,7 +169,7 @@ const App: React.FC = () => {
172
169
}
173
170
</ SyntaxHighlighter >
174
171
175
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
172
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
176
173
< Space . LeftResizable size = { 200 } style = { { backgroundColor : '#eee' } } >
177
174
{ Description ( "Left resizable" ) }
178
175
</ Space . LeftResizable >
@@ -182,7 +179,7 @@ const App: React.FC = () => {
182
179
< Space . RightResizable size = { 200 } style = { { backgroundColor : '#eee' } } >
183
180
{ Description ( "Right resizable" ) }
184
181
</ Space . RightResizable >
185
- </ Fixed >
182
+ </ Space . Fixed >
186
183
187
184
< h3 > Top and bottom resizable spaces</ h3 >
188
185
@@ -198,7 +195,7 @@ const App: React.FC = () => {
198
195
}
199
196
</ SyntaxHighlighter >
200
197
201
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
198
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
202
199
< Space . TopResizable size = { 100 } style = { { backgroundColor : '#eee' } } >
203
200
{ Description ( "Top resizable" ) }
204
201
</ Space . TopResizable >
@@ -208,7 +205,7 @@ const App: React.FC = () => {
208
205
< Space . BottomResizable size = { 100 } style = { { backgroundColor : '#eee' } } >
209
206
{ Description ( "Bottom resizable" ) }
210
207
</ Space . BottomResizable >
211
- </ Fixed >
208
+ </ Space . Fixed >
212
209
213
210
< p >
214
211
Additional properties can be specified to constrain the resizing:
@@ -233,7 +230,7 @@ const App: React.FC = () => {
233
230
}
234
231
</ SyntaxHighlighter >
235
232
236
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
233
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
237
234
< Space . LeftResizable size = { 200 } minimumSize = { 150 } maximumSize = { 250 } style = { { backgroundColor : '#eee' } } >
238
235
{ Description ( "Left resizable" ) }
239
236
</ Space . LeftResizable >
@@ -243,7 +240,7 @@ const App: React.FC = () => {
243
240
< Space . RightResizable size = { 200 } minimumSize = { 150 } maximumSize = { 250 } style = { { backgroundColor : '#eee' } } >
244
241
{ Description ( "Right resizable" ) }
245
242
</ Space . RightResizable >
246
- </ Fixed >
243
+ </ Space . Fixed >
247
244
248
245
< h2 > Nested spaces</ h2 >
249
246
@@ -269,7 +266,7 @@ const App: React.FC = () => {
269
266
}
270
267
</ SyntaxHighlighter >
271
268
272
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
269
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
273
270
< Space . TopResizable size = { 100 } style = { { backgroundColor : '#eee' } } >
274
271
{ Description ( "Top resizable" ) }
275
272
</ Space . TopResizable >
@@ -287,7 +284,7 @@ const App: React.FC = () => {
287
284
< Space . BottomResizable size = { 100 } style = { { backgroundColor : '#eee' } } >
288
285
{ Description ( "Bottom resizable" ) }
289
286
</ Space . BottomResizable >
290
- </ Fixed >
287
+ </ Space . Fixed >
291
288
292
289
< h3 > Top/bottom spaces nested within left/full/right spaces</ h3 >
293
290
@@ -307,7 +304,7 @@ const App: React.FC = () => {
307
304
}
308
305
</ SyntaxHighlighter >
309
306
310
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
307
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
311
308
< Space . LeftResizable size = { 150 } style = { { backgroundColor : '#e0eeee' } } >
312
309
{ Description ( "Left resizable" ) }
313
310
</ Space . LeftResizable >
@@ -325,7 +322,7 @@ const App: React.FC = () => {
325
322
< Space . RightResizable size = { 150 } style = { { backgroundColor : '#e0eeee' } } >
326
323
{ Description ( "Right resizable" ) }
327
324
</ Space . RightResizable >
328
- </ Fixed >
325
+ </ Space . Fixed >
329
326
330
327
< h2 > Stacked spaces</ h2 >
331
328
@@ -349,7 +346,7 @@ const App: React.FC = () => {
349
346
}
350
347
</ SyntaxHighlighter >
351
348
352
- < Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
349
+ < Space . Fixed height = { 400 } style = { { border : "1px solid navy" , margin : 25 } } >
353
350
< Space . LeftResizable size = { 125 } order = { 1 } style = { { backgroundColor : '#eee' } } >
354
351
{ Description ( "Left resizable 1" ) }
355
352
</ Space . LeftResizable >
@@ -365,7 +362,7 @@ const App: React.FC = () => {
365
362
< Space . RightResizable size = { 125 } order = { 2 } style = { { backgroundColor : '#e0eeee' } } >
366
363
{ Description ( "Right resizable 2" ) }
367
364
</ Space . RightResizable >
368
- </ Fixed >
365
+ </ Space . Fixed >
369
366
370
367
< h2 > UI</ h2 >
371
368
@@ -375,23 +372,23 @@ const App: React.FC = () => {
375
372
example using some < strong > antd</ strong > components.
376
373
</ p >
377
374
378
- < Fixed height = { 400 } style = { { margin : 25 } } >
375
+ < Space . Fixed height = { 400 } style = { { margin : 25 } } >
379
376
380
377
< Space . Left order = { 1 } size = { 50 } style = { { backgroundColor : 'maroon' } } />
381
378
382
379
< Space . Fill >
383
380
384
381
< Space . TopResizable size = { 65 } minimumSize = { 65 } maximumSize = { 120 } style = { darkStyleWithPadding } >
385
382
386
- < Centered >
383
+ < Space . Centered >
387
384
< h1 style = { { color : 'white' } } > Header</ h1 >
388
- </ Centered >
385
+ </ Space . Centered >
389
386
390
387
< Space . Right size = { 160 } >
391
388
392
- < Centered >
389
+ < Space . Centered >
393
390
< Button onClick = { ( ) => setSecondBarVisible ( ! secondSideBarVisible ) } > Toggle sidebar</ Button >
394
- </ Centered >
391
+ </ Space . Centered >
395
392
396
393
</ Space . Right >
397
394
@@ -480,7 +477,7 @@ const App: React.FC = () => {
480
477
481
478
</ Space . Fill >
482
479
483
- </ Fixed >
480
+ </ Space . Fixed >
484
481
485
482
</ div >
486
483
</ div >
0 commit comments