semantic-ui-react
Version:
The official Semantic-UI-React integration.
53 lines (44 loc) • 1.96 kB
JavaScript
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, useKeyOnly } from '../../lib';
/**
* Comments can be grouped.
*/
function CommentGroup(props) {
var className = props.className,
children = props.children,
collapsed = props.collapsed,
content = props.content,
minimal = props.minimal,
size = props.size,
threaded = props.threaded;
var classes = cx('ui', size, useKeyOnly(collapsed, 'collapsed'), useKeyOnly(minimal, 'minimal'), useKeyOnly(threaded, 'threaded'), 'comments', className);
var rest = getUnhandledProps(CommentGroup, props);
var ElementType = getElementType(CommentGroup, props);
return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, {
className: classes
}), childrenUtils.isNil(children) ? content : children);
}
CommentGroup.handledProps = ["as", "children", "className", "collapsed", "content", "minimal", "size", "threaded"];
CommentGroup.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,
/** Comments can be collapsed, or hidden from view. */
collapsed: PropTypes.bool,
/** Shorthand for primary content. */
content: customPropTypes.contentShorthand,
/** Comments can hide extra information unless a user shows intent to interact with a comment. */
minimal: PropTypes.bool,
/** Comments can have different sizes. */
size: PropTypes.oneOf(_without(SUI.SIZES, 'medium')),
/** A comment list can be threaded to showing the relationship between conversations. */
threaded: PropTypes.bool
} : {};
export default CommentGroup;