@zendeskgarden/react-grid 8.50.1 → 8.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,12 +3,24 @@
3
3
  This package includes components relating to layout grids in the
4
4
  [Garden Design System](https://zendeskgarden.github.io/).
5
5
 
6
+ ## Grid
7
+
6
8
  The `Grid` component is inspired by the Bootstrap flexbox
7
9
  [grid](https://getbootstrap.com/docs/4.3/layout/grid/). With Garden, all of
8
10
  the features are dynamic (based on props) – including the number of grid
9
11
  columns and gutter width. The result is an incredibly powerful grid system
10
12
  that will be immediately familiar to users of Bootstrap.
11
13
 
14
+ ## Pane
15
+
16
+ The `Pane.Splitter` component enables resizable-layouts between one or
17
+ more panes. `PaneProvider` and `Pane`
18
+ coordinate multiple `Pane.Splitter` components in a
19
+ [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) or
20
+ [CSS Flex](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout)
21
+ layout. The `PaneProvider` and `Pane.Splitter` components receive `fr` units as
22
+ values for building responsive resizable layouts by default.
23
+
12
24
  ## Installation
13
25
 
14
26
  ```sh
@@ -41,3 +53,53 @@ import { Grid, Row, Col } from '@zendeskgarden/react-grid';
41
53
  </Grid>
42
54
  </ThemeProvider>;
43
55
  ```
56
+
57
+ ```jsx
58
+ import { ThemeProvider } from '@zendeskgarden/react-theming';
59
+ import { PaneProvider, Pane } from '@zendeskgarden/react-grid';
60
+
61
+ /**
62
+ * Place a `ThemeProvider` at the root of your React application
63
+ */
64
+ <ThemeProvider>
65
+ <PaneProvider
66
+ totalPanesHeight={1000}
67
+ totalPanesWidth={1000}
68
+ defaultColumnValues={{ 'col-1': 1, 'col-2': 1 }}
69
+ defaultRowValues={{ 'row-1': 1, 'row-2': 1 }}
70
+ >
71
+ {({ getGridTemplateColumns, getGridTemplateRows }) => (
72
+ <div
73
+ style={{
74
+ display: 'grid',
75
+ width: '1000px',
76
+ height: '1000px',
77
+ gridTemplateRows: getGridTemplateRows(),
78
+ gridTemplateColumns: getGridTemplateColumns()
79
+ }}
80
+ >
81
+ <Pane>
82
+ <Pane.Content>Pane 1</Pane.Content>
83
+ <Pane.Splitter layoutKey="col-1" min={0} max={2} orientation="end" />
84
+ </Pane>
85
+ <Pane>
86
+ <Pane.Content>Pane 2</Pane.Content>
87
+ <Pane.Splitter layoutKey="row-1" min={0} max={2} orientation="bottom">
88
+ <Pane.SplitterButton label="toggle row-1" />
89
+ </Pane.Splitter>
90
+ </Pane>
91
+ <Pane>
92
+ <Pane.Content>Pane 3</Pane.Content>
93
+ <Pane.Splitter layoutKey="row-2" min={0} max={2} orientation="top">
94
+ <Pane.SplitterButton label="toggle row-2" placement="end" />
95
+ </Pane.Splitter>
96
+ </Pane>
97
+ <Pane>
98
+ <Pane.Content>Pane 4</Pane.Content>
99
+ <Pane.Splitter layoutKey="col-2" min={0} max={2} orientation="start" />
100
+ </Pane>
101
+ </div>
102
+ )}
103
+ </PaneProvider>
104
+ </ThemeProvider>;
105
+ ```