UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

50 lines 2.54 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { BaseComponent, classNamesFunction } from '../../Utilities'; import { PersonaSize } from '../../Persona'; import { PersonaCoin } from '../../PersonaCoin'; var getClassNames = classNamesFunction(); /** * {@docCategory DocumentCard} */ var DocumentCardActivityBase = /** @class */ (function (_super) { tslib_1.__extends(DocumentCardActivityBase, _super); function DocumentCardActivityBase() { return _super !== null && _super.apply(this, arguments) || this; } DocumentCardActivityBase.prototype.render = function () { var _a = this.props, activity = _a.activity, people = _a.people, styles = _a.styles, theme = _a.theme, className = _a.className; this._classNames = getClassNames(styles, { theme: theme, className: className, multiplePeople: people.length > 1 }); if (!people || people.length === 0) { return null; } return (React.createElement("div", { className: this._classNames.root }, this._renderAvatars(people), React.createElement("div", { className: this._classNames.details }, React.createElement("span", { className: this._classNames.name }, this._getNameString(people)), React.createElement("span", { className: this._classNames.activity }, activity)))); }; DocumentCardActivityBase.prototype._renderAvatars = function (people) { return (React.createElement("div", { className: this._classNames.avatars }, people.length > 1 ? this._renderAvatar(people[1]) : null, this._renderAvatar(people[0]))); }; DocumentCardActivityBase.prototype._renderAvatar = function (person) { return (React.createElement("div", { className: this._classNames.avatar }, React.createElement(PersonaCoin, { imageInitials: person.initials, text: person.name, imageUrl: person.profileImageSrc, initialsColor: person.initialsColor, allowPhoneInitials: person.allowPhoneInitials, role: "presentation", size: PersonaSize.size32 }))); }; DocumentCardActivityBase.prototype._getNameString = function (people) { var nameString = people[0].name; if (people.length >= 2) { nameString += ' +' + (people.length - 1); } return nameString; }; return DocumentCardActivityBase; }(BaseComponent)); export { DocumentCardActivityBase }; //# sourceMappingURL=DocumentCardActivity.base.js.map