UNPKG

@atlaskit/profilecard

Version:

A React component to display a card with user information.

51 lines (50 loc) 2.57 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } import React from 'react'; import IconRecent from '@atlaskit/icon/core/migration/clock--recent'; import IconEmail from '@atlaskit/icon/core/migration/email'; import IconLocation from '@atlaskit/icon/core/migration/location'; import OfficeBuildingIcon from '@atlaskit/icon/core/migration/office-building'; import { fg } from '@atlaskit/platform-feature-flags'; import { DetailsLabel, DetailsLabelIcon, DetailsLabelText } from '../../styled/Card'; var icons = { location: IconLocation, time: IconRecent, email: IconEmail, companyName: OfficeBuildingIcon }; var IconLabel = /*#__PURE__*/function (_React$PureComponent) { function IconLabel() { _classCallCheck(this, IconLabel); return _callSuper(this, IconLabel, arguments); } _inherits(IconLabel, _React$PureComponent); return _createClass(IconLabel, [{ key: "render", value: function render() { if (!this.props.children) { return null; } // @ts-ignore var IconElement = this.props.icon && icons[this.props.icon]; var displayIcon = IconElement ? /*#__PURE__*/React.createElement(IconElement, { label: "".concat(this.props.icon), LEGACY_size: "small", color: fg('compiled-migration-profilecard') ? "var(--ds-text-subtlest, #626F86)" : 'currentColor' }) : null; return /*#__PURE__*/React.createElement(DetailsLabel, { extraTopSpace: this.props.extraTopSpace }, /*#__PURE__*/React.createElement(DetailsLabelIcon, null, displayIcon), /*#__PURE__*/React.createElement(DetailsLabelText, null, this.props.children)); } }]); }(React.PureComponent); _defineProperty(IconLabel, "defaultProps", { icon: '' }); export { IconLabel as default };