Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit 2d8aa5e

Browse files
committed
Merge pull request #33 from axelson/easier-click
Create a container for JSONArrow for easier clickability/UX
2 parents 8a9fb1d + c619c13 commit 2d8aa5e

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

src/JSONArrow.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const styles = {
55
display: 'inline-block',
66
marginLeft: 0,
77
marginTop: 8,
8-
marginRight: 5,
98
'float': 'left',
109
transition: '150ms',
1110
WebkitTransition: '150ms',
@@ -15,8 +14,13 @@ const styles = {
1514
transform: 'rotateZ(-90deg)',
1615
position: 'relative'
1716
},
18-
baseDouble: {
19-
marginRight: 10
17+
container: {
18+
display: 'inline-block',
19+
padding: '2 5',
20+
cursor: 'pointer'
21+
},
22+
containerDouble: {
23+
padding: '2 10'
2024
},
2125
arrow: {
2226
borderLeft: '5px solid transparent',
@@ -38,6 +42,9 @@ const styles = {
3842

3943
export default class JSONArrow extends React.Component {
4044
render() {
45+
let containerStyle = {
46+
...styles.container
47+
};
4148
let style = {
4249
...styles.base,
4350
...styles.arrow
@@ -52,20 +59,22 @@ export default class JSONArrow extends React.Component {
5259
};
5360
}
5461
if (this.props.double) {
55-
style = {
56-
...style,
57-
...styles.baseDouble
62+
containerStyle = {
63+
...containerStyle,
64+
...styles.containerDouble
5865
};
5966
}
6067
style = {
6168
...style,
6269
...this.props.style
6370
};
6471
return (
65-
<div style={{ ...color, ...style }} onClick={this.props.onClick}>
66-
{this.props.double &&
67-
<div style={{ ...color, ...styles.inner, ...styles.arrow }} />
68-
}
72+
<div style={containerStyle} onClick={this.props.onClick}>
73+
<div style={{ ...color, ...style }}>
74+
{this.props.double &&
75+
<div style={{ ...color, ...styles.inner, ...styles.arrow }} />
76+
}
77+
</div>
6978
</div>
7079
);
7180
}

src/JSONNestedNode.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ const STYLES = {
7373
label: {
7474
margin: 0,
7575
padding: 0,
76-
display: 'inline-block'
76+
display: 'inline-block',
77+
cursor: 'pointer'
7778
},
7879
span: {
7980
cursor: 'default'

0 commit comments

Comments
 (0)