Files
starface-outlook-sync-addin/node_modules/@fluentui/react/lib-commonjs/components/DocumentCard/DocumentCardActivity.base.js
T
Stefan Hacker 37ad745546 first commit
2026-04-03 09:38:48 +02:00

55 lines
2.7 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentCardActivityBase = void 0;
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var Persona_1 = require("../../Persona");
var PersonaCoin_1 = require("../../PersonaCoin");
var getClassNames = (0, Utilities_1.classNamesFunction)();
/**
* {@docCategory DocumentCard}
*/
var DocumentCardActivityBase = /** @class */ (function (_super) {
tslib_1.__extends(DocumentCardActivityBase, _super);
function DocumentCardActivityBase(props) {
var _this = _super.call(this, props) || this;
(0, Utilities_1.initializeComponentRef)(_this);
return _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_1.PersonaCoin, { imageInitials: person.initials, text: person.name, imageUrl: person.profileImageSrc, initialsColor: person.initialsColor, allowPhoneInitials: person.allowPhoneInitials, role: "presentation", size: Persona_1.PersonaSize.size32 })));
};
DocumentCardActivityBase.prototype._getNameString = function (people) {
var nameString = people[0].name;
if (people.length >= 2) {
nameString += ' +' + (people.length - 1);
}
return nameString;
};
return DocumentCardActivityBase;
}(React.Component));
exports.DocumentCardActivityBase = DocumentCardActivityBase;
//# sourceMappingURL=DocumentCardActivity.base.js.map