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

Create a container for JSONArrow for easier clickability/UX #33

Merged
merged 1 commit into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions src/JSONArrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const styles = {
display: 'inline-block',
marginLeft: 0,
marginTop: 8,
marginRight: 5,
'float': 'left',
transition: '150ms',
WebkitTransition: '150ms',
Expand All @@ -15,8 +14,13 @@ const styles = {
transform: 'rotateZ(-90deg)',
position: 'relative'
},
baseDouble: {
marginRight: 10
container: {
display: 'inline-block',
padding: '2 5',
cursor: 'pointer'
},
containerDouble: {
padding: '2 10'
},
arrow: {
borderLeft: '5px solid transparent',
Expand All @@ -38,6 +42,9 @@ const styles = {

export default class JSONArrow extends React.Component {
render() {
let containerStyle = {
...styles.container
};
let style = {
...styles.base,
...styles.arrow
Expand All @@ -52,20 +59,22 @@ export default class JSONArrow extends React.Component {
};
}
if (this.props.double) {
style = {
...style,
...styles.baseDouble
containerStyle = {
...containerStyle,
...styles.containerDouble
};
}
style = {
...style,
...this.props.style
};
return (
<div style={{ ...color, ...style }} onClick={this.props.onClick}>
{this.props.double &&
<div style={{ ...color, ...styles.inner, ...styles.arrow }} />
}
<div style={containerStyle} onClick={this.props.onClick}>
<div style={{ ...color, ...style }}>
{this.props.double &&
<div style={{ ...color, ...styles.inner, ...styles.arrow }} />
}
</div>
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/JSONNestedNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const STYLES = {
label: {
margin: 0,
padding: 0,
display: 'inline-block'
display: 'inline-block',
cursor: 'pointer'
},
span: {
cursor: 'default'
Expand Down