UNPKG

semantic-ui-react

Version:
46 lines (36 loc) 991 B
import cx from 'classnames' import _ from 'lodash' import React, { PropTypes } from 'react' import { customPropTypes, getElementType, getUnhandledProps, META, } from '../../lib' function LabelDetail(props) { const { children, className, content } = props const classes = cx('detail', className) const rest = getUnhandledProps(LabelDetail, props) const ElementType = getElementType(LabelDetail, props) return ( <ElementType {...rest} className={classes}> {_.isNil(children) ? content : children} </ElementType> ) } LabelDetail._meta = { name: 'LabelDetail', parent: 'Label', type: META.TYPES.ELEMENT, } LabelDetail.propTypes = { /** An element type to render as (string or function). */ as: customPropTypes.as, /** Primary content. */ children: PropTypes.node, /** Additional classes. */ className: PropTypes.string, /** Shorthand for primary content. */ content: customPropTypes.contentShorthand, } export default LabelDetail