UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

51 lines 1.95 kB
var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { cssClasses } from '@douyinfe/semi-foundation/lib/es/card/constants'; import cls from 'classnames'; const prefixcls = cssClasses.PREFIX; class Meta extends PureComponent { render() { const _a = this.props, { avatar, className, description, style, title } = _a, others = __rest(_a, ["avatar", "className", "description", "style", "title"]); const metaCls = cls(`${prefixcls}-meta`, className); const avatarNode = avatar && (/*#__PURE__*/React.createElement("div", { className: `${prefixcls}-meta-avatar` }, avatar)); const titleNode = title && (/*#__PURE__*/React.createElement("div", { className: `${prefixcls}-meta-wrapper-title` }, title)); const descriptionNode = description && (/*#__PURE__*/React.createElement("div", { className: `${prefixcls}-meta-wrapper-description` }, description)); const wrapper = title || description ? (/*#__PURE__*/React.createElement("div", { className: `${prefixcls}-meta-wrapper` }, titleNode, descriptionNode)) : null; return /*#__PURE__*/React.createElement("div", Object.assign({}, others, { className: metaCls, style: style }), avatarNode, wrapper); } } Meta.propTypes = { avatar: PropTypes.node, className: PropTypes.string, description: PropTypes.node, style: PropTypes.object, title: PropTypes.node }; export default Meta;