UNPKG

@atlaskit/profilecard

Version:

A React component to display a card with user information.

35 lines (34 loc) 1.45 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; 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'; const icons = { location: IconLocation, time: IconRecent, email: IconEmail, companyName: OfficeBuildingIcon }; export default class IconLabel extends React.PureComponent { render() { if (!this.props.children) { return null; } // @ts-ignore const IconElement = this.props.icon && icons[this.props.icon]; const displayIcon = IconElement ? /*#__PURE__*/React.createElement(IconElement, { label: `${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)); } } _defineProperty(IconLabel, "defaultProps", { icon: '' });