UNPKG

@atlaskit/profilecard

Version:

A React component to display a card with user information.

33 lines (32 loc) 1.26 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import React from 'react'; import IconRecent from '@atlaskit/icon/core/clock'; import IconEmail from '@atlaskit/icon/core/email'; import IconLocation from '@atlaskit/icon/core/location'; import OfficeBuildingIcon from '@atlaskit/icon/core/office-building'; 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}`, color: "var(--ds-text-subtlest, #6B6E76)" }) : 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: '' });