UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

27 lines (26 loc) 2.58 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; define(["require", "exports", 'react', '../../utilities/css', '../../Image', './Persona.Props', './PersonaConsts', './Persona.scss'], function (require, exports, React, css_1, Image_1, Persona_Props_1, PersonaConsts_1) { "use strict"; var Persona = (function (_super) { __extends(Persona, _super); function Persona() { _super.apply(this, arguments); } Persona.prototype.render = function () { var _a = this.props, className = _a.className, size = _a.size, imageUrl = _a.imageUrl, imageInitials = _a.imageInitials, initialsColor = _a.initialsColor, presence = _a.presence, primaryText = _a.primaryText, secondaryText = _a.secondaryText, tertiaryText = _a.tertiaryText, optionalText = _a.optionalText, hidePersonaDetails = _a.hidePersonaDetails; return (React.createElement("div", React.__spread({}, this.props, {className: css_1.css('ms-Persona', className, PersonaConsts_1.PERSONA_SIZE[size], PersonaConsts_1.PERSONA_PRESENCE[presence])}), size !== Persona_Props_1.PersonaSize.tiny && (React.createElement("div", {className: 'ms-Persona-imageArea'}, React.createElement("div", {className: css_1.css('ms-Persona-initials', PersonaConsts_1.PERSONA_INITIALS_COLOR[initialsColor])}, imageInitials), React.createElement(Image_1.Image, {className: 'ms-Persona-image', imageFit: Image_1.ImageFit.cover, src: imageUrl}))), presence !== Persona_Props_1.PersonaPresence.none && React.createElement("div", {className: 'ms-Persona-presence'}), !hidePersonaDetails && (React.createElement("div", {className: 'ms-Persona-details'}, React.createElement("div", {className: 'ms-Persona-primaryText'}, primaryText), secondaryText ? (React.createElement("div", {className: 'ms-Persona-secondaryText'}, secondaryText)) : (null), React.createElement("div", {className: 'ms-Persona-tertiaryText'}, tertiaryText), React.createElement("div", {className: 'ms-Persona-optionalText'}, optionalText), this.props.children)))); }; Persona.defaultProps = { primaryText: '', size: Persona_Props_1.PersonaSize.regular, initialsColor: Persona_Props_1.PersonaInitialsColor.blue, presence: Persona_Props_1.PersonaPresence.none }; return Persona; }(React.Component)); exports.Persona = Persona; });