Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ryan-hamblin/492813961b53aeabac876b1d26051ad7 to your computer and use it in GitHub Desktop.
Save ryan-hamblin/492813961b53aeabac876b1d26051ad7 to your computer and use it in GitHub Desktop.
React Pretty Printer
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',
},
})
@mairan02
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment