Skip to content

Commit 8ae2f69

Browse files
committed
#43 show and hide explorer
1 parent c0de2a3 commit 8ae2f69

File tree

4 files changed

+111
-11
lines changed

4 files changed

+111
-11
lines changed

ui-react/src/BlockExplorer/Block.css

+40-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.blockExplorer {
1+
.BlockExplorerDetailView {
22
padding-left: 30px;
33
border-left-style: dotted;
44
border-color: #4D4E56;
@@ -13,16 +13,12 @@
1313
display: flex;
1414
flex-direction: column;
1515
padding-top: 10px;
16-
1716
animation-name: slideDown;
1817
-webkit-animation-name: slideDown;
19-
2018
animation-duration: 1s;
2119
-webkit-animation-duration: 1s;
22-
2320
animation-timing-function: ease;
2421
-webkit-animation-timing-function: ease;
25-
2622
visibility: visible !important;
2723

2824
}
@@ -137,3 +133,42 @@
137133
width: 2px;
138134
background: white;
139135
}
136+
137+
.blockSmall {
138+
width: 21px;
139+
height: 21px;
140+
border-radius: 5px;
141+
border: 1px solid #393941;
142+
background: linear-gradient(135deg, #1c1c23 0%, #393941 50%, #1c1c23 100%);
143+
cursor: pointer;
144+
animation-name: slideDown;
145+
-webkit-animation-name: slideDown;
146+
animation-duration: 1s;
147+
-webkit-animation-duration: 1s;
148+
animation-timing-function: ease;
149+
-webkit-animation-timing-function: ease;
150+
visibility: visible !important;
151+
}
152+
153+
.blockSmallLink {
154+
height: 10px;
155+
width: 2px;
156+
background: white;
157+
margin: auto;
158+
}
159+
160+
.minimizeSign {
161+
height: 2px;
162+
width: 10px;
163+
background: #393941;
164+
cursor: pointer;
165+
}
166+
167+
.minimizeButton {
168+
cursor: pointer;
169+
padding:10px;
170+
border: solid;
171+
border-width: 1px;
172+
width: 12px;
173+
border-color: #393941;
174+
}

ui-react/src/BlockExplorer/BlockExplorer.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import React, { Component } from 'react';
22
import './Block.css';
3-
import Block from './Block';
3+
import BlockExplorerPreview from './BlockExplorerPreview';
4+
import BlockExplorerDetailView from './BlockExplorerDetailView';
45

56
class BlockExplorer extends Component {
67

78
constructor(props) {
89
super(props);
910
this.state = {
10-
blocks: []
11+
blocks: [],
12+
preview: true
1113
};
1214
this.getBlocks = this.getBlocks.bind(this);
1315
this.getBlocks();
@@ -25,10 +27,18 @@ class BlockExplorer extends Component {
2527

2628
render() {
2729
return (
28-
<div className="blockExplorer">
29-
{this.state.blocks.map(block => (
30-
<Block block={block} key={block.id} />
31-
))}
30+
<div>
31+
{ this.state.preview ?
32+
<BlockExplorerPreview
33+
blocks={this.state.blocks}
34+
onExpand={() => this.setState({ preview: false })}
35+
/>
36+
:
37+
<BlockExplorerDetailView
38+
blocks={this.state.blocks}
39+
onMin={() => this.setState({ preview: true })}
40+
/>
41+
}
3242
</div>
3343
);
3444
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import './Block.css';
4+
import Block from './Block';
5+
6+
class BlockExplorerDetailView extends Component {
7+
8+
9+
render() {
10+
return (
11+
<div className="BlockExplorerDetailView">
12+
<div className="minimizeButton" role="presentation" onClick={this.props.onMin}>
13+
<div className="minimizeSign" />
14+
</div>
15+
{this.props.blocks.map(block => (
16+
<Block block={block} key={block.id} />
17+
))}
18+
</div>
19+
);
20+
}
21+
}
22+
23+
BlockExplorerDetailView.propTypes = {
24+
blocks: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
25+
onMin: PropTypes.func.isRequired
26+
};
27+
28+
export default BlockExplorerDetailView;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import './Block.css';
4+
5+
class BlockExplorerPreview extends Component {
6+
7+
8+
render() {
9+
return (
10+
<div role="presentation" onClick={this.props.onExpand}>
11+
{this.props.blocks.map(() => (
12+
<div>
13+
<div className="blockSmallLink" />
14+
<div className="blockSmall" />
15+
</div>
16+
))}
17+
</div>
18+
);
19+
}
20+
}
21+
22+
BlockExplorerPreview.propTypes = {
23+
blocks: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
24+
onExpand: PropTypes.func.isRequired
25+
};
26+
27+
export default BlockExplorerPreview;

0 commit comments

Comments
 (0)