-
Notifications
You must be signed in to change notification settings - Fork 73
/
index.html
211 lines (151 loc) · 6.35 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, minimal-ui, minimum-scale=1.0, initial-scale=1, user-scalable=no"/>
<link rel="shortcut icon" href="./resources/img/react.png" type="image/x-icon"/>
<title>Re-F|ex Demo</title>
</head>
<body>
<img src="./resources/img/re-flex-banner.png" width="100%">
<br>
<br>
<h3>
<a id="demo1">1 - Basic Re-Flex example:</a>
</h3>
<div>
The most basic example with two fixed panes vertically arranged. By default each <b><i>ReflexElement</i></b>
will be equally arranged within its <b><i>ReflexContainer</i></b>. To specify a custom arrangement, you can use <b><i>flex={number in [0.0, 1.0]}</i></b>
property.
</div>
<br>
<script src="https://gist.github.com/leefsmp/a89beb85548b4d0889baeb497e1f75a8.js"></script>
<div id="demo-basic"></div>
<br>
<h3>
<a id="demo2">2 - Basic Re-Flex example with splitter:</a>
</h3>
<div>
Basic example with two resizable panes vertically arranged: placing a <b><i>ReflexSplitter</i></b>
draggable component between two <b><i>ReflexElements</i></b> will allow those elements to be manually resized by user.
</div>
<br>
<script src="https://gist.github.com/leefsmp/da739ef3f4b2a9a15498453550d27bf0.js"></script>
<div id="demo-basic-splitter"></div>
<br>
<h3>
<a id="demo3">3 - Re-Flex example with splitter propagation (2x):</a>
</h3>
<div>
Example with two splitters propagating the drag: this is where Re-Flex really makes the difference between any other
layout library you can find out there.
<br>
<br>
Setting the <b><i>propagate={true}</i></b>
property on the <b><i>ReflexSplitter</i></b> components will propagate the drag all the way from right to left or
left to right (respectively up and down for an horizontal layout) depending on user interaction. In that demo <b><i>minSize</i></b>
and <b><i>maxSize</i></b> properties are also specified on the middle pane, Re-Flex will respect those attributes when dragging
and propagating the offset applied by user.
</div>
<br>
<script src="https://gist.github.com/leefsmp/679a1189c0e9922b8ff5d2f511dde523.js"></script>
<div id="demo-splitter-propagation-2x"></div>
<br>
<h3>
<a id="demo4">4 - Re-Flex example with splitter propagation (3x):</a>
</h3>
<div>
Example with three splitters propagating the drag, same as example above but one more splitter just for fun ...
</div>
<br>
<script src="https://gist.github.com/leefsmp/04a74bb4fdb6c513590cceed84038ccd.js"></script>
<div id="demo-splitter-propagation-3x"></div>
<br>
<h3>
<a id="demo5">5 - Advanced Re-Flex example:</a>
</h3>
<div>
A more advanced example with multi-nested resizable layouts using events: while dragging a splitter
the affected panes will get a different background color, illustrating how you can use Re-Flex events to
perform some additional custom logic.
</div>
<br>
<script src="https://gist.github.com/leefsmp/0dc99af3505d259506cdec74a4c18bc7.js"></script>
<br>
<br>
Try the sample below and judge the power of Re-Flex ...
<br>
<br>
<div id="demo-advanced"></div>
<br>
<h3>
<a id="demo6">6 - Controlled elements Re-Flex example:</a>
</h3>
<div>
A more verbose example that illustrates how to programmatically control the <b><i>size</i></b> of <b><i>ReflexElements</i></b>.
<br>
<br>
Clicking the (<b><i>- / +</i></b>) buttons in the control bar above each pane will respectively minimize or
maximize that pane into the allocated layout space.
<br>
<br>
Clicking the (<b><i>=</i></b>) button will lock the pane to its current size. Click the button again to unlock it.
</div>
<br>
<script src="https://gist.github.com/leefsmp/3b0a01068a1d15c1de971bf9747fd87c.js"></script>
<div id="demo-controls"></div>
<br>
<h3>
<a id="demo7">7 - Size-aware element Re-Flex example:</a>
</h3>
<div>
This demo illustrates how to enable <b><i>ReflexElement</i></b> children to be "<i>size-aware</i>".
Under the hoods, Re-Flex is using <a href="https://github.com/souporserious/react-measure" target="_blank">react-measure</a> to inject a
<b><i>dimensions</i></b> property to its child elements.
<br>
<br>
To activate that feature, you need to use use <b><i>propagateDimensions={true}</i></b> and also <b><i>renderOnResize={true}</i></b>
in order to force the child elelement to re-render when its size has been modified.
</div>
<br>
<script src="https://gist.github.com/leefsmp/f79c50a1ddcbd9566d629d76efeb1fd7.js"></script>
<div id="demo-size-aware"></div>
<br>
<h3>
<a id="demo8">8 - Storage Re-Flex example:</a>
</h3>
<div>
This demo illustrates how to use <b><i>onResize</i></b> event on <b><i>ReflexElement</i></b> to create a persistent layout state:
Everytime a pane is being resized, we store the current layout state to the localStorage and restore it when the component gets created.
Reload the page to see the layout will appear in the same state as you left it.
</div>
<br>
<script src="https://gist.github.com/leefsmp/28ceb226d119d179d1e94466d2dd1a8b.js"></script>
<div id="demo-storage"></div>
<br>
<h3>
<a id="demo9">9 - Collapsible panels Re-Flex example:</a>
</h3>
<div>
This demo illustrates how to create collapsible panels with Re-Flex:
the side panels will collapse when their size becomes smaller than the defined threshold.
</div>
<br>
<script src="https://gist.github.com/leefsmp/a159d18a5fc55b7a3a7b9435d09a95f5.js"></script>
<div id="demo-collapse"></div>
<br>
<h3>
<a id="demo10">10 - Handle Element Re-Flex example:</a>
</h3>
<div>
This demo illustrates how to use a ReflexHandle:
when inserted as child of a ReflexElement, a ReflexHandle allows user to resize
the element as if the splitter was manipulated. It needs to be inserted as child of an
element following a splitter.
</div>
<br>
<script src="https://gist.github.com/leefsmp/bf5400d3fcaf58dbac5d7cf36f6e8133.js"></script>
<div id="demo-handle"></div>
<br>
<script src="dist/demo/bundle.js"></script>
<div id="page-footer-filler"></div>
</body>
</html>