Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use ReactJS to create style guide
var React = require('react');
var beautify = require('js-beautify').html
var StyleBlock = React.createClass({
render: function () {
var Element = this.props.element
return (
<div className="style-name">
{} &nbsp;
this.props.filepath ?
<small className="">file path: {this.props.filepath}</small> : ''
<div className="style-block">
<div className="style-example">
<Element />
<div className="style-code">
<pre className="language-markup">
<code className="language-markup">
{ beautify( React.renderToStaticMarkup(<Element />), { indent_size: 2, unformatted: ['button'] }) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.