UNPKG

semantic-ui-react

Version:
50 lines (40 loc) 1.13 kB
import cx from 'classnames' import PropTypes from 'prop-types' import React from 'react' import { childrenUtils, customPropTypes, getElementType, getUnhandledProps, META, } from '../../lib' /** * A comment can contain an list of actions a user may perform related to this comment. */ function CommentActions(props) { const { className, children, content } = props const classes = cx('actions', className) const rest = getUnhandledProps(CommentActions, props) const ElementType = getElementType(CommentActions, props) return ( <ElementType {...rest} className={classes}> {childrenUtils.isNil(children) ? content : children} </ElementType> ) } CommentActions._meta = { name: 'CommentActions', parent: 'Comment', type: META.TYPES.VIEW, } CommentActions.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 CommentActions