UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

40 lines (33 loc) 882 B
import React, { PureComponent } from 'react'; import classNames from 'classnames'; import styles from './badge.scss'; import PropTypes from 'prop-types'; class Badge extends PureComponent { static displayName = 'Badge'; static propTypes = { /** Additional classes */ className: PropTypes.string, /** String based node */ children: PropTypes.node, /** Type of Badge */ type: PropTypes.oneOf(['warning', 'error']), }; static defaultProps = { type: 'warning', }; render() { const { className, children, type, } = this.props; return ( <div className={classNames(className, styles.root, styles[`type-${type}`])} > {children} </div> ); } } export default Badge;