Skip to content

Commit b5e3aef

Browse files
committed
Added fix for playground related previews
1 parent ed88439 commit b5e3aef

File tree

2 files changed

+49
-8
lines changed

2 files changed

+49
-8
lines changed
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1+
:local(.playground-preview) {
2+
position: fixed;
3+
height: 100%;
4+
width: 60%;
5+
.header {
6+
font-size: 24px;
7+
font-weight: bold;
8+
}
9+
}
10+
111
:local(.playground) {
212
position: fixed;
3-
height: 50%;
4-
width: 100%;
13+
width: 40%;
14+
height: 100%;
15+
border: 1px solid;
16+
}
17+
18+
:local(.preview) {
519
.header {
620
font-size: 24px;
721
font-weight: bold;
822
}
9-
}
23+
position: fixed;
24+
left: 55%;
25+
width: 35%;
26+
height: 100%;
27+
border: 1px solid;
28+
}

docs/client/components/PlaygroundPage/index.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,41 @@ class PlaygroundPage extends React.Component {
77
constructor(props) {
88
super(props);
99
this.state = {
10-
active: '',
10+
isDocumentationOn: false,
11+
activeComponent: '',
1112
};
13+
this.expandDocumentation = this.expandDocumentation.bind(this);
14+
this.handleClickComponent = this.handleClickComponent.bind(this);
15+
}
16+
17+
expandDocumentation() {
18+
this.setState({
19+
isDocumentationOn: !this.state.isDocumentationOn,
20+
});
21+
}
22+
23+
handleClickComponent(activeComponent) {
24+
this.setState({
25+
activeComponent,
26+
});
1227
}
1328

1429
render() {
1530
return (
1631
<div>
17-
<ComponentBar>
18-
<PlaygroundWithPreview />
19-
<Documentation />
32+
<ComponentBar
33+
onClickComponent={this.handleClickComponent}
34+
>
35+
<PlaygroundWithPreview
36+
activeComponent={this.state.activeComponent}
37+
/>
38+
<Documentation
39+
isDocumentationOn={this.state.isDocumentationOn}
40+
expandDocumentation={this.expandDocumentation}
41+
/>
2042
</ComponentBar>
2143
</div>
22-
)
44+
);
2345
}
2446
}
2547

0 commit comments

Comments
 (0)