You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
911 B
43 lines
911 B
import React, { Component } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import classnames from 'classnames'
|
|
|
|
const CLASSNAME_DEFAULT = 'btn-default'
|
|
const CLASSNAME_PRIMARY = 'btn-primary'
|
|
const CLASSNAME_SECONDARY = 'btn-secondary'
|
|
const CLASSNAME_LARGE = 'btn--large'
|
|
|
|
const typeHash = {
|
|
default: CLASSNAME_DEFAULT,
|
|
primary: CLASSNAME_PRIMARY,
|
|
secondary: CLASSNAME_SECONDARY,
|
|
}
|
|
|
|
class Button extends Component {
|
|
render () {
|
|
const { type, large, className, ...buttonProps } = this.props
|
|
|
|
return (
|
|
<button
|
|
className={classnames(
|
|
typeHash[type],
|
|
large && CLASSNAME_LARGE,
|
|
className
|
|
)}
|
|
{ ...buttonProps }
|
|
>
|
|
{ this.props.children }
|
|
</button>
|
|
)
|
|
}
|
|
}
|
|
|
|
Button.propTypes = {
|
|
type: PropTypes.string,
|
|
large: PropTypes.bool,
|
|
className: PropTypes.string,
|
|
children: PropTypes.string,
|
|
}
|
|
|
|
export default Button
|
|
|
|
|