@zohodesk/dot
Version:
In this Library, we Provide Some Basic Components to Build Your Application
52 lines (50 loc) • 1.55 kB
JavaScript
import React from 'react';
import { defaultProps } from "./props/defaultProps";
import { propTypes } from "./props/propTypes";
import Link from "../../Link/Link";
import { whiteSpaceClassMapping } from '@zohodesk/components/es/utils/cssUtils';
import style from "../../../list/Subject/Subject.module.css";
const Subject = props => {
const {
text,
dataId,
urlName,
href,
urlData,
onClick,
isLink,
target,
fontWeight,
className,
isDotted,
children,
customProps,
whiteSpace
} = props;
const {
LinkProps = {},
TextProps = {}
} = customProps;
return /*#__PURE__*/React.createElement(React.Fragment, null, isLink ? /*#__PURE__*/React.createElement(Link, {
urlName: urlName,
href: href,
urlData: urlData,
onClick: onClick,
className: `${style.subject} ${isDotted ? style.dotted : ''} ${whiteSpaceClassMapping[whiteSpace]} ${className} ${style[`font_${fontWeight}`]} ${style.cursorPointer}`,
dataId: dataId,
title: text,
target: target,
"data-title-wrap": whiteSpace,
...LinkProps
}, children ? children : text) : /*#__PURE__*/React.createElement("span", {
className: `${style.subject} ${isDotted ? style.dotted : ''} ${whiteSpaceClassMapping[whiteSpace]} ${className} ${style[`font_${fontWeight}`]}`,
"data-title": text,
"data-id": dataId,
"data-test-id": dataId,
"data-title-wrap": whiteSpace,
...TextProps
}, text));
};
export default Subject;
Subject.propTypes = propTypes;
Subject.defaultProps = defaultProps;