-
-
Save IainIsCreative/d320546942c2a47f3e1a192ae43c16e1 to your computer and use it in GitHub Desktop.
Revisions
-
jamesslock created this gist
Apr 20, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,82 @@ import React, { Component, PropTypes } from 'react'; import { Link } from 'react-router'; import css from './Button.css'; export default class Button extends Component { render() { const { className, active, buttonType, children, context, size, style, varient, fullWidth, onClick, ...remainingProps, } = this.props; const classNames = [ css.root, context ? css[context] : null, varient ? css[varient] : null, css ? css[css] : null, size ? css[size] : null, fullWidth ? css.fullWidth : null, active ? css.active : null, className, ].join(' '); return buttonType === 'Link' ? <Link className={classNames} {...remainingProps} > {children} </Link> : <button className={classNames} onClick={onClick} {...remainingProps} > {children} </button> } }; Button.propTypes = { active: PropTypes.bool, children: PropTypes.any, className: PropTypes.string, fullWidth: PropTypes.bool, context: PropTypes.oneOf([ 'primary', 'secondary', 'tertiary' ]), varient: PropTypes.oneOf([ 'link', 'outline', ]), style: PropTypes.oneOf([ 'soft', 'hard', ]), size: PropTypes.oneOf([ 'natural', 'small', 'medium', 'large', 'huge', ]), onClick: PropTypes.func, };