Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unify The UI With React

Dan Cork
April 28, 2016

Unify The UI With React

Dan Cork

April 28, 2016
Tweet

More Decks by Dan Cork

Other Decks in Technology

Transcript

  1. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  2. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  3. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  4. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  5. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  6. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  7. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  8. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  9. var Button = React.createClass({ propTypes: { children: React.PropTypes.string }, render:

    function() { return ( <button className=“component-button"> {this.props.children} </button> ) } })
  10. propTypes: { // sizes small: React.PropTypes.bool, large: React.PropTypes.bool, // colors

    primary: React.PropTypes.bool, danger: React.PropTypes.bool }
  11. import classNames from ‘class-names’ classNames({ ‘btn’: true, ‘btn-small’: this.props.small, ‘btn-large’:

    this.props.large, ‘btn-primary’: this.props.primary, ‘btn-danger’: this.props.danger });
  12. .base { /* default styling */ } .error { composes:

    base; /* extra styling for error */ }