import React from 'react'
import PropTypes from 'prop-types'
import cx from 'classnames'
import ButtonStyled from './button.styled'
const Button = ({
htmlType = 'button',
type = 'default',
className,
width = '100%',
height = '40px',
onClick,
disabled,
icon,
badge = null,
badgeType = 'danger',
children,
...rest
}) => (
<ButtonStyled
{...rest}
className={cx(className, type)}
width={width}
height={height}
onClick={onClick}
disabled={disabled}
type={htmlType}
>
{badge !== null && <div className={cx(badgeType, 'button-badge')}><span className='button-badge-label'>{badge}</span></div>}
<div className='content-button'>
{icon && <span className="icon">{icon}</span>}
{children && <span>{children}</span>}
</div>
</ButtonStyled>
)
Button.propTypes = {
disabled: PropTypes.bool,
onClick: PropTypes.func.isRequired,
className: PropTypes.string,
height: PropTypes.string,
width: PropTypes.string,
htmlType: PropTypes.string,
children: PropTypes.node,
type: PropTypes.oneOf([
'primary',
'secondary',
'danger',
'default'
]),
icon: PropTypes.string
}
export { Button }
|