UNPKG

semantic-ui-react

Version:
43 lines (34 loc) 945 B
import cx from 'classnames' import PropTypes from 'prop-types' import React from 'react' import { createHTMLImage, customPropTypes, getElementType, getUnhandledProps, META, } from '../../lib' /** * A comment can contain an image or avatar. */ function CommentAvatar(props) { const { className, src } = props const classes = cx('avatar', className) const rest = getUnhandledProps(CommentAvatar, props) const ElementType = getElementType(CommentAvatar, props) return <ElementType {...rest} className={classes}>{createHTMLImage(src)}</ElementType> } CommentAvatar._meta = { name: 'CommentAvatar', parent: 'Comment', type: META.TYPES.VIEW, } CommentAvatar.propTypes = { /** An element type to render as (string or function). */ as: customPropTypes.as, /** Additional classes. */ className: PropTypes.string, /** Specifies the URL of the image. */ src: PropTypes.string, } export default CommentAvatar