Skip to content

Commit

Permalink
chore: fix error in button
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelramalho19 committed Nov 16, 2020
1 parent 3f5c51b commit e59f689
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/components/button/Button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import './Button.css'
import classNames from 'classnames'
import PropTypes from 'prop-types'

const getButtonClassName = ({ fill, bg, color, danger, disabled }, type) => {
if (danger) return 'bg-red fill-white white'
Expand All @@ -9,13 +10,10 @@ const getButtonClassName = ({ fill, bg, color, danger, disabled }, type) => {
return `${fill} ${bg} ${color}`
}

const Button = ({ className, minWidth, children, style, type, ...props }) => {
return (
<button type={type} className={classNames('Button transition-all sans-serif dib v-mid fw5 nowrap lh-copy bn br1 pa2 focus-outline', className, getButtonClassName(props, type))} disabled={props.disabled} style={{ minWidth, ...style }} {...props}>
{children}
</button>
)
}
const Button = ({ className, minWidth, children, style, type, danger, ...props }) =>
<button type={type} className={classNames('Button transition-all sans-serif dib v-mid fw5 nowrap lh-copy bn br1 pa2 focus-outline', className, getButtonClassName(props, type))} disabled={props.disabled} style={{ minWidth, ...style }} {...props}>
{children}
</button>

Button.defaultProps = {
bg: 'bg-teal',
Expand All @@ -25,4 +23,9 @@ Button.defaultProps = {
minWidth: 140
}

Button.propTypes = {
danger: PropTypes.bool,
disabled: PropTypes.bool
}

export default Button

0 comments on commit e59f689

Please sign in to comment.