Skip to content

Commit 6b989f5

Browse files
committed
Seperated demo and component lib
1 parent 80d9733 commit 6b989f5

32 files changed

+4253
-38
lines changed

package.json renamed to demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"react-dom": "^16.8.6",
1717
"react-scripts": "3.0.1",
1818
"react-syntax-highlighter": "^11.0.2",
19-
"typescript": "^3.5.3"
19+
"typescript": "^3.5.3",
20+
"react-spaces": "file:../react-spaces"
2021
},
2122
"scripts": {
2223
"start": "react-scripts start",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/App.tsx renamed to demo/src/App.tsx

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import React, { CSSProperties } from 'react';
2-
import './App.css';
3-
import * as Space from './components/Space';
2+
import * as Space from 'react-spaces';
43
import { Tabs, Menu, Button} from 'antd';
54
import 'antd/dist/antd.css';
6-
import { Centered } from './components/Centered';
7-
import { Fixed } from './components/FixedSizeContainer';
85
import SyntaxHighlighter from 'react-syntax-highlighter';
96
import './App.scss';
107

118
const darkStyle: CSSProperties = { backgroundColor: '#333', color: 'white' };
129
const darkStyleWithPadding: CSSProperties = { ...darkStyle, ...{ padding: 13 } };
1310

1411
const Description = (props: string) => (
15-
<Centered>
12+
<Space.Centered>
1613
<strong>{props}</strong>
1714
<Space.Info>{info => <div>{info.width} x {info.height}</div> }</Space.Info>
18-
</Centered>
15+
</Space.Centered>
1916
)
2017

2118
const App: React.FC = () => {
@@ -34,7 +31,7 @@ const App: React.FC = () => {
3431

3532
<h2>Top level spaces</h2>
3633

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>
3835

3936
<ul>
4037
<li>
@@ -111,7 +108,7 @@ const App: React.FC = () => {
111108
}
112109
</SyntaxHighlighter>
113110

114-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
111+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
115112
<Space.Left size={200} style={{ backgroundColor: '#eee' }}>
116113
{Description("Left")}
117114
</Space.Left>
@@ -121,7 +118,7 @@ const App: React.FC = () => {
121118
<Space.Right size={200} style={{ backgroundColor: '#eee' }}>
122119
{Description("Right")}
123120
</Space.Right>
124-
</Fixed>
121+
</Space.Fixed>
125122

126123
<h3>Top and bottom spaces</h3>
127124

@@ -137,7 +134,7 @@ const App: React.FC = () => {
137134
}
138135
</SyntaxHighlighter>
139136

140-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
137+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
141138
<Space.Top size={100} style={{ backgroundColor: '#eee' }}>
142139
{Description("Top")}
143140
</Space.Top>t5 cf
@@ -147,7 +144,7 @@ const App: React.FC = () => {
147144
<Space.Bottom size={100} style={{ backgroundColor: '#eee' }}>
148145
{Description("Bottom")}
149146
</Space.Bottom>
150-
</Fixed>
147+
</Space.Fixed>
151148

152149
<h2>Resizable spaces</h2>
153150

@@ -172,7 +169,7 @@ const App: React.FC = () => {
172169
}
173170
</SyntaxHighlighter>
174171

175-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
172+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
176173
<Space.LeftResizable size={200} style={{ backgroundColor: '#eee' }}>
177174
{Description("Left resizable")}
178175
</Space.LeftResizable>
@@ -182,7 +179,7 @@ const App: React.FC = () => {
182179
<Space.RightResizable size={200} style={{ backgroundColor: '#eee' }}>
183180
{Description("Right resizable")}
184181
</Space.RightResizable>
185-
</Fixed>
182+
</Space.Fixed>
186183

187184
<h3>Top and bottom resizable spaces</h3>
188185

@@ -198,7 +195,7 @@ const App: React.FC = () => {
198195
}
199196
</SyntaxHighlighter>
200197

201-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
198+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
202199
<Space.TopResizable size={100} style={{ backgroundColor: '#eee' }}>
203200
{Description("Top resizable")}
204201
</Space.TopResizable>
@@ -208,7 +205,7 @@ const App: React.FC = () => {
208205
<Space.BottomResizable size={100} style={{ backgroundColor: '#eee' }}>
209206
{Description("Bottom resizable")}
210207
</Space.BottomResizable>
211-
</Fixed>
208+
</Space.Fixed>
212209

213210
<p>
214211
Additional properties can be specified to constrain the resizing:
@@ -233,7 +230,7 @@ const App: React.FC = () => {
233230
}
234231
</SyntaxHighlighter>
235232

236-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
233+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
237234
<Space.LeftResizable size={200} minimumSize={150} maximumSize={250} style={{ backgroundColor: '#eee' }}>
238235
{Description("Left resizable")}
239236
</Space.LeftResizable>
@@ -243,7 +240,7 @@ const App: React.FC = () => {
243240
<Space.RightResizable size={200} minimumSize={150} maximumSize={250} style={{ backgroundColor: '#eee' }}>
244241
{Description("Right resizable")}
245242
</Space.RightResizable>
246-
</Fixed>
243+
</Space.Fixed>
247244

248245
<h2>Nested spaces</h2>
249246

@@ -269,7 +266,7 @@ const App: React.FC = () => {
269266
}
270267
</SyntaxHighlighter>
271268

272-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
269+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
273270
<Space.TopResizable size={100} style={{ backgroundColor: '#eee' }}>
274271
{Description("Top resizable")}
275272
</Space.TopResizable>
@@ -287,7 +284,7 @@ const App: React.FC = () => {
287284
<Space.BottomResizable size={100} style={{ backgroundColor: '#eee' }}>
288285
{Description("Bottom resizable")}
289286
</Space.BottomResizable>
290-
</Fixed>
287+
</Space.Fixed>
291288

292289
<h3>Top/bottom spaces nested within left/full/right spaces</h3>
293290

@@ -307,7 +304,7 @@ const App: React.FC = () => {
307304
}
308305
</SyntaxHighlighter>
309306

310-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
307+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
311308
<Space.LeftResizable size={150} style={{ backgroundColor: '#e0eeee' }}>
312309
{Description("Left resizable")}
313310
</Space.LeftResizable>
@@ -325,7 +322,7 @@ const App: React.FC = () => {
325322
<Space.RightResizable size={150} style={{ backgroundColor: '#e0eeee' }}>
326323
{Description("Right resizable")}
327324
</Space.RightResizable>
328-
</Fixed>
325+
</Space.Fixed>
329326

330327
<h2>Stacked spaces</h2>
331328

@@ -349,7 +346,7 @@ const App: React.FC = () => {
349346
}
350347
</SyntaxHighlighter>
351348

352-
<Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
349+
<Space.Fixed height={400} style={{ border: "1px solid navy", margin: 25 }}>
353350
<Space.LeftResizable size={125} order={1} style={{ backgroundColor: '#eee' }}>
354351
{Description("Left resizable 1")}
355352
</Space.LeftResizable>
@@ -365,7 +362,7 @@ const App: React.FC = () => {
365362
<Space.RightResizable size={125} order={2} style={{ backgroundColor: '#e0eeee' }}>
366363
{Description("Right resizable 2")}
367364
</Space.RightResizable>
368-
</Fixed>
365+
</Space.Fixed>
369366

370367
<h2>UI</h2>
371368

@@ -375,23 +372,23 @@ const App: React.FC = () => {
375372
example using some <strong>antd</strong> components.
376373
</p>
377374

378-
<Fixed height={400} style={{ margin: 25 }}>
375+
<Space.Fixed height={400} style={{ margin: 25 }}>
379376

380377
<Space.Left order={1} size={50} style={{ backgroundColor: 'maroon' }} />
381378

382379
<Space.Fill>
383380

384381
<Space.TopResizable size={65} minimumSize={65} maximumSize={120} style={darkStyleWithPadding}>
385382

386-
<Centered>
383+
<Space.Centered>
387384
<h1 style={{ color: 'white' }}>Header</h1>
388-
</Centered>
385+
</Space.Centered>
389386

390387
<Space.Right size={160}>
391388

392-
<Centered>
389+
<Space.Centered>
393390
<Button onClick={() => setSecondBarVisible(!secondSideBarVisible)}>Toggle sidebar</Button>
394-
</Centered>
391+
</Space.Centered>
395392

396393
</Space.Right>
397394

@@ -480,7 +477,7 @@ const App: React.FC = () => {
480477

481478
</Space.Fill>
482479

483-
</Fixed>
480+
</Space.Fixed>
484481

485482
</div>
486483
</div>

src/index.tsx renamed to demo/src/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import './index.css';
43
import App from './App';
54
import * as serviceWorker from './serviceWorker';
65

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)