@zohodesk/dot
Version:
In this Library, we Provide Some Basic Components to Build Your Application
98 lines (96 loc) • 3.49 kB
JavaScript
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React, { Component } from 'react';
import { ContactName_defaultProps } from "./props/defaultProps";
import { ContactName_propTypes } from "./props/propTypes";
import { Container, Box } from '@zohodesk/components/es/Layout';
import Typography from '@zohodesk/components/es/Typography/Typography';
import { DUMMY_OBJECT } from '@zohodesk/components/es/utils/Common';
import Link from "../../Link/Link";
import SentimentStatus from "../SentimentStatus/SentimentStatus";
import { Icon } from '@zohodesk/icons';
import style from "./SecondaryText.module.css";
export default class ContactName extends Component {
render() {
let {
dataTitle,
dataId,
isPaidUser,
urlName,
urlData,
onClick,
sentimentType,
isLink,
className,
text,
href,
notAccessible = false,
fontWeight,
i18nKeys,
highlightData,
isHighlighted,
customProps
} = this.props;
let {
sentimentTitles = {
positive: 'Positive',
negative: 'Negative',
neutral: 'Neutral'
},
paidTitle = 'Paid User'
} = i18nKeys;
let sentimentDataTitle = sentimentTitles[sentimentType];
let {
LinkProps = {},
TextProps = {}
} = customProps;
return /*#__PURE__*/React.createElement(Container, {
alignBox: "row",
align: "baseline",
isCover: false,
dataId: dataId
}, isPaidUser && /*#__PURE__*/React.createElement(Box, {
className: style.paidUserIcon,
title: paidTitle,
"aria-label": "Paid user"
}, /*#__PURE__*/React.createElement(Icon, {
name: "ZD-paiduser",
iconClass: style.icon
})), /*#__PURE__*/React.createElement(Box, {
flexible: true
}, isLink ? /*#__PURE__*/React.createElement(Link, _extends({
urlName: urlName,
href: href,
urlData: urlData,
onClick: onClick,
title: dataTitle,
dataId: `${dataId}_link`,
className: style.link
}, LinkProps, {
ariaLabel: `Contact Name ${text}`
}), /*#__PURE__*/React.createElement(Typography, {
$flag_dotted: true,
$ui_size: "12",
$ui_weight: fontWeight,
$ui_className: `${style.linkWithText} ${className ? className : ''}`,
$ui_highlightConfig: isHighlighted ? highlightData : DUMMY_OBJECT
}, text)) : /*#__PURE__*/React.createElement(Typography, {
$tagAttributes_text: TextProps,
$ui_size: "12",
$flag_dotted: true,
$ui_className: `${style.secondaryText} ${className ? className : ''} ${notAccessible ? style.disable : ''}`,
$ui_weight: fontWeight,
$i18n_dataTitle: dataTitle,
$ui_highlightConfig: isHighlighted ? highlightData : DUMMY_OBJECT
}, text)), sentimentType && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(SentimentStatus, {
type: sentimentType,
dataTitle: sentimentDataTitle
})));
}
}
ContactName.propTypes = ContactName_propTypes;
ContactName.defaultProps = ContactName_defaultProps; // if (__DOCS__) {
// ContactName.docs = {
// folderName: 'List',
// componentGroup: 'ContactName'
// };
// }