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

Commit

Permalink
Merge pull request #33 from axelson/easier-click
Browse files Browse the repository at this point in the history
Create a container for JSONArrow for easier clickability/UX
  • Loading branch information
chibicode committed Mar 17, 2016
2 parents 8a9fb1d + c619c13 commit 2d8aa5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
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

0 comments on commit 2d8aa5e

Please sign in to comment.