1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 05:12:18 +01:00
metamask-extension/ui/app/components/button/button.component.js

44 lines
911 B
JavaScript
Raw Normal View History

2018-05-20 08:04:19 +02:00
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
2018-05-03 19:51:15 +02:00
const CLASSNAME_DEFAULT = 'btn-default'
2018-05-03 19:51:15 +02:00
const CLASSNAME_PRIMARY = 'btn-primary'
const CLASSNAME_SECONDARY = 'btn-secondary'
const CLASSNAME_LARGE = 'btn--large'
2018-05-03 19:51:15 +02:00
const typeHash = {
default: CLASSNAME_DEFAULT,
primary: CLASSNAME_PRIMARY,
secondary: CLASSNAME_SECONDARY,
2018-05-03 19:51:15 +02:00
}
class Button extends Component {
render () {
const { type, large, className, ...buttonProps } = this.props
return (
2018-05-20 08:04:19 +02:00
<button
className={classnames(
typeHash[type],
large && CLASSNAME_LARGE,
className
)}
2018-05-20 08:04:19 +02:00
{ ...buttonProps }
>
{ this.props.children }
</button>
2018-05-03 19:51:15 +02:00
)
}
}
Button.propTypes = {
type: PropTypes.string,
large: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.string,
}
2018-05-20 08:04:19 +02:00
export default Button
2018-05-03 19:51:15 +02:00