mistadikay
3/10/2016 - 8:03 AM

medium-rebem-9-3.js

/*
.
└── custom-components/
    └── button
        └── index.js
*/
// js from the last layer, styles from all previous layers
import Button from '#button';
// import Button from 'core-components/button/index.js';
// import from 'theme-reset/styles.less';

export default class extends React.Component {
  renderIcon(icon) {
    if (icon) {
      return <span block="button" elem="icon" style={{ backgroundImage: icon }} />;
    }

    return null;
  },

  render() {
    return (
      <Button {...this.props}>
        {this.props.children}
        {this.renderIcon(this.props.icon)}
      </Button>
    );
  }
}