UNPKG

semantic-ui-react

Version:
38 lines (29 loc) 1 kB
import cx from 'clsx' import PropTypes from 'prop-types' import React from 'react' import { childrenUtils, customPropTypes, getElementType, getUnhandledProps } from '../../lib' /** * Header content wraps the main content when there is an adjacent Icon or Image. */ function HeaderContent(props) { const { children, className, content } = props const classes = cx('content', className) const rest = getUnhandledProps(HeaderContent, props) const ElementType = getElementType(HeaderContent, props) return ( <ElementType {...rest} className={classes}> {childrenUtils.isNil(children) ? content : children} </ElementType> ) } HeaderContent.propTypes = { /** An element type to render as (string or function). */ as: PropTypes.elementType, /** Primary content. */ children: PropTypes.node, /** Additional classes. */ className: PropTypes.string, /** Shorthand for primary content. */ content: customPropTypes.contentShorthand, } export default HeaderContent