UNPKG

semantic-ui-react

Version:
41 lines (35 loc) 1.45 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _without from "lodash-es/without"; import cx from 'clsx'; import PropTypes from 'prop-types'; import React from 'react'; import { childrenUtils, customPropTypes, getElementType, getUnhandledProps, SUI, useTextAlignProp } from '../../lib'; /** * A card can contain a header. */ function CardHeader(props) { var children = props.children, className = props.className, content = props.content, textAlign = props.textAlign; var classes = cx(useTextAlignProp(textAlign), 'header', className); var rest = getUnhandledProps(CardHeader, props); var ElementType = getElementType(CardHeader, props); return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, { className: classes }), childrenUtils.isNil(children) ? content : children); } CardHeader.handledProps = ["as", "children", "className", "content", "textAlign"]; CardHeader.propTypes = process.env.NODE_ENV !== "production" ? { /** 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, /** A card header can adjust its text alignment. */ textAlign: PropTypes.oneOf(_without(SUI.TEXT_ALIGNMENTS, 'justified')) } : {}; export default CardHeader;