Created
May 19, 2017 17:51
-
-
Save ryan-hamblin/492813961b53aeabac876b1d26051ad7 to your computer and use it in GitHub Desktop.
React Pretty Printer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React,{PropTypes, Component } from 'react' | |
import {StyleSheet,css} from 'aphrodite'; | |
class Pretty extends Component { | |
constructor(props){ | |
super(props); | |
this.state= { | |
show: false, | |
flag: false, | |
}; | |
} | |
_toggle() { | |
this.setState({ | |
show: !this.state.show, | |
}); | |
} | |
render() { | |
return ( | |
<div className={css(styles.style)}> | |
{this.state.flag ? <div className={css(styles.none)}> | |
<div className={css(styles.headerStyle)} onClick={ this._toggle.bind(this) }> | |
<strong> {this.props.title ? "Label " + this.props.title: "Pretty Debug"}</strong> | |
</div> | |
{( this.state.show ? | |
<pre className={css(styles.preStyle)}> | |
{JSON.stringify(this.props.data, null, 2) } | |
</pre> : false )} | |
</div> : null } | |
</div> | |
); | |
} | |
} | |
export default Pretty; | |
const styles = StyleSheet.create({ | |
style: { | |
backgroundColor: '#1f4662', | |
color: '#fff', | |
fontSize: '12px', | |
}, | |
headerStyle: { | |
backgroundColor: '#193549', | |
padding: '5px 10px', | |
color: '#0070CD', | |
}, | |
preStyle: { | |
display: 'block', | |
padding: '10px 30px', | |
margin: '0', | |
overflow: 'scroll', | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi greetings from me my dear
please can you mail me at ( miranaa1122@hotmail.com ) for beater explanation okay Please am Marina by name i don't have access hear just email me for me to get back to you with all about me wit moue photos okay