UNPKG

@zohodesk/dot

Version:

In this Library, we Provide Some Basic Components to Build Your Application

78 lines (75 loc) 2.69 kB
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 { defaultProps } from "./props/defaultProps"; import { propTypes } from "./props/propTypes"; import Typography from '@zohodesk/components/es/Typography/Typography'; import { DUMMY_OBJECT } from '@zohodesk/components/es/utils/Common'; import Link from "../../Link/Link"; import { whiteSpaceClassMapping } from '@zohodesk/components/es/utils/cssUtils'; import style from "./Subject.module.css"; export default class Subject extends Component { constructor(props) { super(props); } render() { let { text, dataId, urlName, href, urlData, onClick, isLink, target, fontWeight, className, isDotted, children, customProps, whiteSpace, isHighlighted, highlightData } = this.props; let { LinkProps = {}, TextProps = {} } = customProps; let tagAttributesText = { ...TextProps, 'data-title-wrap': whiteSpace }; let linkTagAttributes = { 'data-title-wrap': whiteSpace }; return /*#__PURE__*/React.createElement(React.Fragment, null, isLink ? /*#__PURE__*/React.createElement(Link, _extends({ urlName: urlName, href: href, urlData: urlData, onClick: onClick, target: target, dataId: dataId }, LinkProps), children ? children : /*#__PURE__*/React.createElement(Typography, { $tagAttributes_text: linkTagAttributes, $i18n_dataTitle: text, $ui_className: `${style.subject} ${whiteSpaceClassMapping[whiteSpace]} ${className} ${style.cursorPointer}`, $flag_dotted: isDotted, $ui_weight: fontWeight, $ui_highlightConfig: isHighlighted ? highlightData : DUMMY_OBJECT }, text)) : /*#__PURE__*/React.createElement(Typography, { $tagAttributes_text: tagAttributesText, $ui_className: `${style.subject} ${className} ${whiteSpaceClassMapping[whiteSpace]}`, $flag_dotted: isDotted, $ui_weight: fontWeight, $i18n_dataTitle: text, customId: dataId, testId: dataId, $ui_highlightConfig: isHighlighted ? highlightData : DUMMY_OBJECT }, text)); } } Subject.propTypes = propTypes; Subject.defaultProps = defaultProps; // if (__DOCS__) { // Subject.docs = { // folderName: 'List', // componentGroup: 'Subject' // }; // }