Skip to content

Instantly share code, notes, and snippets.

@interaminense
Created February 28, 2018 04:24
Show Gist options
  • Select an option

  • Save interaminense/058e7b7899404bf957024cc718d90f23 to your computer and use it in GitHub Desktop.

Select an option

Save interaminense/058e7b7899404bf957024cc718d90f23 to your computer and use it in GitHub Desktop.
Mathematics Render Component Button
import Component, {Config} from 'metal-jsx';
import getCN from 'classnames';
class Button extends Component {
render() {
const {children, isActive, style} = this.props;
const classes = getCN('mathematics-btn',
{
['mathematics-btn--active']: isActive,
[`mathematics-btn--${style}`]: style
}
);
return (
<button {...this.otherProps()} class={classes}>
{children}
</button>
);
}
}
Button.PROPS = {
/**
* Adds the classname 'mathematics-btn--active'
* to Button
* @type {boolean}
* @default false
*/
isActive: Config.bool().value(false),
/**
* Sets the Button's color style
* @type {string}
* @default 'default'
*/
style: Config.oneOf(['primary','default']).value('default')
};
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment