Button.jsx 764B

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import classnames from 'classnames'
  4. const Button = props => {
  5. return (
  6. <button
  7. type={props.htmlType}
  8. className={classnames(props.customClass, 'btn', `btn-${props.bootstrapType}`)}
  9. onClick={props.onClick}
  10. >
  11. {props.label}
  12. </button>
  13. )
  14. }
  15. export default Button
  16. Button.propTypes = {
  17. htmlType: PropTypes.oneOf(['button', 'submit', 'reset']).isRequired,
  18. bootstrapType: PropTypes.oneOf(
  19. ['primary', 'default', 'default', 'success', 'danger', 'warning', 'info', 'light', 'dark']
  20. ).isRequired,
  21. customClass: PropTypes.string,
  22. label: PropTypes.string,
  23. onClick: PropTypes.func
  24. }
  25. Button.defaultProps = {
  26. customClass: '',
  27. label: '',
  28. onClick: () => {}
  29. }