Skip to content

Commit 9474834

Browse files
committed
modified to formidable labs
1 parent a97f6c3 commit 9474834

File tree

8 files changed

+53
-265
lines changed

8 files changed

+53
-265
lines changed

docs/client/components/AppNavbar/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ body {
77
}
88

99
:local(.navbar) {
10+
z-index: 10;
1011
position: fixed;
1112
min-height: 75px;
1213
width: 100%;

docs/client/components/PlaygroundPage/PlaygroundWithPreview/Playground.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

docs/client/components/PlaygroundPage/PlaygroundWithPreview/Preview.js

Lines changed: 0 additions & 118 deletions
This file was deleted.

docs/client/components/PlaygroundPage/PlaygroundWithPreview/index.js

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
import React from 'react';
2-
import Preview from './Preview';
3-
import Playground from './Playground';
2+
import {
3+
LiveProvider,
4+
LiveEditor,
5+
LiveError,
6+
LivePreview
7+
} from 'react-live';
8+
import Switch from 'react-switch';
9+
import components from '../../../../../src';
410
import styles from './styles.scss';
5-
6-
const defaultCode = `
7-
class Example extends React.Component {
8-
render() {
9-
return (
10-
<div>
11-
Example
12-
</div>
13-
)
14-
}
15-
}
16-
return <Example />;
17-
`;
11+
import theme from '../../../components/common/DefaultCode/theme.scss';
1812

1913
class PlaygroundWithPreview extends React.Component {
2014
constructor(props) {
@@ -24,12 +18,6 @@ class PlaygroundWithPreview extends React.Component {
2418
};
2519
}
2620

27-
handleOnChangeCode = (code) => {
28-
this.setState({
29-
code,
30-
});
31-
}
32-
3321
render() {
3422
const {
3523
activeComponent,
@@ -42,20 +30,30 @@ class PlaygroundWithPreview extends React.Component {
4230
<div className="header">
4331
Playground
4432
</div>
45-
<div>
46-
<Playground
47-
code={this.props.defaultCode}
48-
onChange={this.handleOnChangeCode}
49-
activeComponent={activeComponent}
50-
expandDocumentation={expandDocumentation}
51-
isDocumentationOn={isDocumentationOn}
52-
/>
53-
54-
<Preview
55-
code={this.state.code}
56-
/>
57-
</div>
58-
33+
<LiveProvider
34+
scope={{ ...components, theme }}
35+
code={this.props.defaultCode}
36+
>
37+
<div className="code-editor">
38+
<LiveEditor />
39+
<div className="doc-enabler">
40+
<label htmlFor="normal-switch">
41+
<div>Show Docs</div>
42+
<Switch
43+
onChange={expandDocumentation}
44+
checked={isDocumentationOn}
45+
className="switch"
46+
/>
47+
</label>
48+
</div>
49+
</div>
50+
<div className="code-preview">
51+
<LivePreview />
52+
<div className="error">
53+
<LiveError />
54+
</div>
55+
</div>
56+
</LiveProvider>
5957
</div>
6058
);
6159
}
Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
11
:local(.playground-preview) {
2-
position: fixed;
3-
height: 100%;
4-
width: 60%;
5-
.header {
6-
font-size: 24px;
7-
font-weight: bold;
8-
margin-bottom: 20px;
9-
margin: 10px 25px;
2+
.prism-code {
3+
white-space: pre-wrap !important;
104
}
11-
}
12-
13-
:local(.playground) {
14-
position: fixed;
15-
left: 15%;
16-
width: 40%;
17-
height: 100%;
18-
.doc-enabler {
19-
margin: 40px auto;
20-
width: 40%;
21-
.switch {
22-
margin-left: 10px;
23-
margin-top: 10px;
24-
}
5+
.code-editor {
6+
width: 50%;
7+
float: left;
258
}
26-
}
279

28-
:local(.preview) {
29-
.header {
30-
font-size: 24px;
31-
font-weight: bold;
10+
.code-preview {
11+
width: 45%;
12+
float: left;
13+
margin-left: 15px;
14+
.error {
15+
color: red;
16+
}
3217
}
33-
position: fixed;
34-
left: 60%;
35-
width: 35%;
36-
height: 100%;
37-
.error {
38-
color: red;
18+
19+
.doc-enabler {
20+
text-align: center;
21+
margin-top: 40px;
3922
}
40-
}
23+
}

docs/client/components/common/DefaultCode/Button/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ class Demo extends React.Component {
3232
)
3333
}
3434
}
35-
36-
return <Demo />;
3735
`;

docs/client/components/common/DefaultCode/Card/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ class Demo extends React.Component {
1111
)
1212
}
1313
}
14-
15-
return <Demo />;
1614
`;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"ramda": "^0.25.0",
5454
"react": "^16.3.2",
5555
"react-css-themr": "^2.1.2",
56-
"react-dom": "^16.3.2"
56+
"react-dom": "^16.3.2",
57+
"react-live": "^1.11.0"
5758
}
5859
}

0 commit comments

Comments
 (0)