All files / src/list/Subject Subject.js

100% Statements 6/6
40% Branches 4/10
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                7x                                     7x 7x 7x                                                                     1x 1x                
import React, { Component } 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 './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
    } = this.props;
    let { LinkProps = {}, TextProps = {} } = customProps;
    return (
      <>
        {isLink ? (
          <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}
          </Link>
        ) : (
          <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}
          </span>
        )}
      </>
    );
  }
}
Subject.propTypes = propTypes;
Subject.defaultProps = defaultProps;
 
// if (__DOCS__) {
//   Subject.docs = {
//     folderName: 'List',
//     componentGroup: 'Subject'
//   };
// }