|
| 1 | +import { Meta, Preview, Props, Story } from '@storybook/addon-docs/blocks'; |
| 2 | + |
| 3 | +import breakpoints from '../../styles/variables/breakpoints'; |
| 4 | +import { Grid, Tile } from '../..'; |
| 5 | + |
| 6 | +<Meta title='Containers|Grid' parameters={{ jest: ['Grid/spec'] }} /> |
| 7 | + |
| 8 | +# Grid |
| 9 | + |
| 10 | +<Preview> |
| 11 | + <Story name='Default'> |
| 12 | + <Grid> |
| 13 | + <Grid.Item> |
| 14 | + <Tile elevation={1} /> |
| 15 | + </Grid.Item> |
| 16 | + <Grid.Item> |
| 17 | + <Tile elevation={1} /> |
| 18 | + </Grid.Item> |
| 19 | + <Grid.Item> |
| 20 | + <Tile elevation={1} /> |
| 21 | + </Grid.Item> |
| 22 | + </Grid> |
| 23 | + </Story> |
| 24 | +</Preview> |
| 25 | + |
| 26 | +### Grid |
| 27 | + |
| 28 | +<Props of={Grid} /> |
| 29 | + |
| 30 | +### Grid.Item |
| 31 | + |
| 32 | +<Props of={Grid.Item} /> |
| 33 | + |
| 34 | +## Breakpoints |
| 35 | + |
| 36 | +| | xsmall | small | medium | large | xlarge | |
| 37 | +|-------------------|--------|-------|--------|--------|--------| |
| 38 | +| Alias | xs | sm | md | lg | xl | |
| 39 | +| Minimum width | 320px | 600px | 768px | 1024px | 1440px | |
| 40 | +| Columns | 4 | 8 | 8 | 12 | 12 | |
| 41 | +| Margins / Gutters | 16px | 16px | 24px | 24px | 24px | |
| 42 | + |
| 43 | +### Extra Small (xs) |
| 44 | + |
| 45 | +<Story name='xs breakpoint'> |
| 46 | + <> |
| 47 | + {Array.from({ length: breakpoints.xs.columns }).map((_, i) => i + 1).map((columns) => |
| 48 | + <React.Fragment key={columns}> |
| 49 | + <Grid> |
| 50 | + <Grid.Item xs={columns}> |
| 51 | + <Tile elevation={1} style={{ padding: 16 }}>xs={columns}</Tile> |
| 52 | + </Grid.Item> |
| 53 | + {(breakpoints.xs.columns - columns > 0) && |
| 54 | + <Grid.Item xs={breakpoints.xs.columns - columns}> |
| 55 | + <Tile elevation={1} style={{ padding: 16 }}>xs={breakpoints.xs.columns - columns}</Tile> |
| 56 | + </Grid.Item>} |
| 57 | + </Grid> |
| 58 | + <br /> |
| 59 | + </React.Fragment> |
| 60 | + )} |
| 61 | + </> |
| 62 | +</Story> |
| 63 | + |
| 64 | +### Small (sm) |
| 65 | + |
| 66 | +<Story name='sm breakpoint'> |
| 67 | + <> |
| 68 | + {Array.from({ length: breakpoints.sm.columns }).map((_, i) => i + 1).map((columns) => |
| 69 | + <React.Fragment key={columns}> |
| 70 | + <Grid> |
| 71 | + <Grid.Item sm={columns}> |
| 72 | + <Tile elevation={1} style={{ padding: 16 }}>sm={columns}</Tile> |
| 73 | + </Grid.Item> |
| 74 | + {(breakpoints.sm.columns - columns > 0) && |
| 75 | + <Grid.Item sm={breakpoints.sm.columns - columns}> |
| 76 | + <Tile elevation={1} style={{ padding: 16 }}>sm={breakpoints.sm.columns - columns}</Tile> |
| 77 | + </Grid.Item>} |
| 78 | + </Grid> |
| 79 | + <br /> |
| 80 | + </React.Fragment> |
| 81 | + )} |
| 82 | + </> |
| 83 | +</Story> |
| 84 | + |
| 85 | +### Medium (md) |
| 86 | + |
| 87 | +<Story name='md breakpoint'> |
| 88 | + <> |
| 89 | + {Array.from({ length: breakpoints.md.columns }).map((_, i) => i + 1).map((columns) => |
| 90 | + <React.Fragment key={columns}> |
| 91 | + <Grid> |
| 92 | + <Grid.Item md={columns}> |
| 93 | + <Tile elevation={1} style={{ padding: 16 }}>md={columns}</Tile> |
| 94 | + </Grid.Item> |
| 95 | + {(breakpoints.md.columns - columns > 0) && |
| 96 | + <Grid.Item md={breakpoints.md.columns - columns}> |
| 97 | + <Tile elevation={1} style={{ padding: 16 }}>md={breakpoints.md.columns - columns}</Tile> |
| 98 | + </Grid.Item>} |
| 99 | + </Grid> |
| 100 | + <br /> |
| 101 | + </React.Fragment> |
| 102 | + )} |
| 103 | + </> |
| 104 | +</Story> |
| 105 | + |
| 106 | +### Large (lg) |
| 107 | + |
| 108 | +<Story name='lg breakpoint'> |
| 109 | + <> |
| 110 | + {Array.from({ length: breakpoints.lg.columns }).map((_, i) => i + 1).map((columns) => |
| 111 | + <React.Fragment key={columns}> |
| 112 | + <Grid> |
| 113 | + <Grid.Item lg={columns}> |
| 114 | + <Tile elevation={1} style={{ padding: 16 }}>lg={columns}</Tile> |
| 115 | + </Grid.Item> |
| 116 | + {(breakpoints.lg.columns - columns > 0) && |
| 117 | + <Grid.Item lg={breakpoints.lg.columns - columns}> |
| 118 | + <Tile elevation={1} style={{ padding: 16 }}>lg={breakpoints.lg.columns - columns}</Tile> |
| 119 | + </Grid.Item>} |
| 120 | + </Grid> |
| 121 | + <br /> |
| 122 | + </React.Fragment> |
| 123 | + )} |
| 124 | + </> |
| 125 | +</Story> |
| 126 | + |
| 127 | +### Extra Large (xl) |
| 128 | + |
| 129 | +<Story name='xl breakpoint'> |
| 130 | + <> |
| 131 | + {Array.from({ length: breakpoints.xl.columns }).map((_, i) => i + 1).map((columns) => |
| 132 | + <React.Fragment key={columns}> |
| 133 | + <Grid> |
| 134 | + <Grid.Item xl={columns}> |
| 135 | + <Tile elevation={1} style={{ padding: 16 }}>xl={columns}</Tile> |
| 136 | + </Grid.Item> |
| 137 | + {(breakpoints.xl.columns - columns > 0) && |
| 138 | + <Grid.Item xl={breakpoints.xl.columns - columns}> |
| 139 | + <Tile elevation={1} style={{ padding: 16 }}>xl={breakpoints.xl.columns - columns}</Tile> |
| 140 | + </Grid.Item>} |
| 141 | + </Grid> |
| 142 | + <br /> |
| 143 | + </React.Fragment> |
| 144 | + )} |
| 145 | + </> |
| 146 | +</Story> |
| 147 | + |
0 commit comments