@@ -3,6 +3,8 @@ import { createProvider } from 'refunk'
3
3
import XRay from 'react-x-ray'
4
4
import Grid from 'react-css-grid'
5
5
import { Box } from 'grid-styled'
6
+ import Bar from './Bar'
7
+ import Slider from './Slider'
6
8
import Col from './Col'
7
9
import Heading from './Heading'
8
10
import Pre from './Pre'
@@ -18,72 +20,78 @@ import Live from './Live'
18
20
19
21
const App = props => (
20
22
< XRay disabled = { ! props . xray } >
21
- < button
22
- onClick = { e => {
23
- props . update ( toggleXRay )
24
- } }
25
- children = 'xray'
26
- />
27
- < div >
28
- < label htmlFor = 'width' > width { props . width } </ label >
29
- < input
30
- type = 'range'
31
- id = 'width'
32
- name = 'width'
33
- max = { widths . length - 1 }
34
- value = { widths . indexOf ( props . width ) }
35
- onChange = { e => props . update ( handleWidthChange ( e . target . value ) ) }
36
- />
37
- </ div >
38
- < div >
39
- < label htmlFor = 'width' > gap { props . gap } </ label >
40
- < input
41
- type = 'range'
42
- id = 'gap'
43
- name = 'gap'
44
- max = { gaps . length - 1 }
45
- value = { gaps . indexOf ( props . gap ) }
46
- onChange = { e => props . update ( handleGapChange ( e . target . value ) ) }
47
- />
48
- </ div >
49
- < Box p = { 3 } >
23
+ < Bar p = { 2 } >
24
+ < Grid width = { 128 } >
25
+ < button
26
+ onClick = { e => {
27
+ props . update ( toggleXRay )
28
+ } }
29
+ children = 'xray'
30
+ />
31
+ < Grid . Item span = { 2 } >
32
+ < label htmlFor = 'width' > width { props . width } </ label >
33
+ < Slider
34
+ id = 'width'
35
+ name = 'width'
36
+ max = { widths . length - 1 }
37
+ value = { widths . indexOf ( props . width ) }
38
+ onChange = { e => props . update ( handleWidthChange ( e . target . value ) ) }
39
+ />
40
+ </ Grid . Item >
41
+ < Grid . Item span = { 2 } >
42
+ < label htmlFor = 'width' > gap { props . gap } </ label >
43
+ < Slider
44
+ type = 'range'
45
+ id = 'gap'
46
+ name = 'gap'
47
+ max = { gaps . length - 1 }
48
+ value = { gaps . indexOf ( props . gap ) }
49
+ onChange = { e => props . update ( handleGapChange ( e . target . value ) ) }
50
+ />
51
+ </ Grid . Item >
52
+ </ Grid >
53
+ </ Bar >
54
+ < Box p = { [ 2 , 3 ] } >
50
55
< Grid
51
56
width = { props . width }
52
57
gap = { props . gap }
53
58
align = 'baseline' >
54
- < Heading . h1 > React CSS Grid</ Heading . h1 >
55
59
< Grid . Item >
56
- < Text >
60
+ < Heading . h1 > React CSS Grid</ Heading . h1 >
61
+ < Text mb = { 2 } >
57
62
React layout component based on CSS Grid Layout and built with
58
63
{ ' ' }
59
64
< Link href = 'https://styled-components.com' >
60
65
styled-components
61
66
</ Link >
62
67
</ Text >
68
+ < Flex >
69
+ < BlockLink
70
+ mr = { 1 }
71
+ href = 'https://travis-ci.org/jxnblk/react-css-grid' >
72
+ < Image
73
+ src = 'https://img.shields.io/travis/jxnblk/react-css-grid/master.svg?style=flat-square'
74
+ height = '20'
75
+ />
76
+ </ BlockLink >
77
+ < Tweet />
78
+ < BlockLink
79
+ ml = { 1 }
80
+ href = 'https://github.com/jxnblk/react-css-grid' >
81
+ < Image
82
+ src = 'https://img.shields.io/github/stars/jxnblk/react-css-grid.svg?style=social& label = Star '
83
+ />
84
+ </ BlockLink >
85
+ </ Flex >
63
86
</ Grid . Item >
64
- < Pre > npm i react-css-grid</ Pre >
65
- < Flex >
66
- < BlockLink
67
- mr = { 1 }
68
- href = 'https://travis-ci.org/jxnblk/react-css-grid' >
69
- < Image
70
- src = 'https://img.shields.io/travis/jxnblk/react-css-grid/master.svg?style=flat-square'
71
- height = '20'
72
- />
73
- </ BlockLink >
74
- < Tweet />
75
- < BlockLink
76
- ml = { 1 }
77
- href = 'https://github.com/jxnblk/react-css-grid' >
78
- < Image
79
- src = 'https://img.shields.io/github/stars/jxnblk/react-css-grid.svg?style=social& label = Star '
80
- />
81
- </ BlockLink >
82
- </ Flex >
83
87
< div >
88
+ < Heading > Install</ Heading >
89
+ < Pre > npm i react-css-grid</ Pre >
90
+ </ div >
91
+ < Grid . Item >
84
92
< Heading mb = { 2 } > Usage</ Heading >
85
93
< Pre children = { usage } />
86
- </ div >
94
+ </ Grid . Item >
87
95
< div >
88
96
< Heading mb = { 2 } > Features</ Heading >
89
97
< List >
@@ -125,12 +133,20 @@ const App = props => (
125
133
< Heading mb = { 2 } > Gap</ Heading >
126
134
< Live code = { gapExample } />
127
135
</ div >
136
+ < div >
137
+ < Heading mb = { 2 } > Align</ Heading >
138
+ < Live code = { alignExample } />
139
+ </ div >
128
140
< footer >
129
- < Flex >
130
- < Link href = 'https://github.com/jxnblk/react-css-grid' > GitHub</ Link >
131
- < Box mr = { 1 } />
132
- < Link href = 'http://jxnblk.com' > Made by Jxnblk</ Link >
133
- </ Flex >
141
+ < Heading mb = { 2 } > Footer</ Heading >
142
+ < List >
143
+ < li >
144
+ < Link href = 'https://github.com/jxnblk/react-css-grid' > GitHub</ Link >
145
+ </ li >
146
+ < li >
147
+ < Link href = 'http://jxnblk.com' > Made by Jxnblk</ Link >
148
+ </ li >
149
+ </ List >
134
150
</ footer >
135
151
</ Grid >
136
152
</ Box >
@@ -167,6 +183,13 @@ const gapExample = `<Grid
167
183
<h2>Hi</h2>
168
184
</Grid>`
169
185
186
+ const alignExample = `<Grid
187
+ width={96}
188
+ align='baseline'>
189
+ <h2>Hello</h2>
190
+ <h4>Hi</h4>
191
+ </Grid>`
192
+
170
193
const state = {
171
194
width : 320 ,
172
195
gap : 32 ,
0 commit comments