UNPKG

semantic-ui-react

Version:
65 lines (56 loc) 1.9 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import cx from 'clsx'; import PropTypes from 'prop-types'; import React from 'react'; import { childrenUtils, createShorthand, customPropTypes, getElementType, getUnhandledProps } from '../../lib'; import FeedDate from './FeedDate'; import FeedUser from './FeedUser'; /** * A feed can contain a summary. */ function FeedSummary(props) { var children = props.children, className = props.className, content = props.content, date = props.date, user = props.user; var classes = cx('summary', className); var rest = getUnhandledProps(FeedSummary, props); var ElementType = getElementType(FeedSummary, props); if (!childrenUtils.isNil(children)) { return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, { className: classes }), children); } return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, { className: classes }), createShorthand(FeedUser, function (val) { return { content: val }; }, user, { autoGenerateKey: false }), content && ' ', content, content && ' ', createShorthand(FeedDate, function (val) { return { content: val }; }, date, { autoGenerateKey: false })); } FeedSummary.handledProps = ["as", "children", "className", "content", "date", "user"]; FeedSummary.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, /** Shorthand for FeedDate. */ date: customPropTypes.itemShorthand, /** Shorthand for FeedUser. */ user: customPropTypes.itemShorthand } : {}; export default FeedSummary;