All files / src/avatar/AvatarClose AvatarClose.js

100% Statements 6/6
75% Branches 3/4
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                1x       1x 1x 1x                           1x 1x            
import React from 'react';
import { defaultProps } from './props/defaultProps';
import { propTypes } from './props/propTypes';
import Avatar from '@zohodesk/components/lib/Avatar/Avatar';
import { Icon } from '@zohodesk/icons';
import style from './AvatarClose.module.css';
export default class AvatarClose extends React.Component {
  constructor(props) {
    super(props);
  }
 
  render() {
    let { title, src, name, size, isClose, onClick, customProps, dataSelectorId, dataId } = this.props;
    let { AvatarCloseProps = {}, AvatarProps = {} } = customProps;
    return (
      <div className={style.container} data-selector-id={dataSelectorId} data-id={dataId} data-test-id={dataId} {...AvatarCloseProps}>
        <Avatar src={src} name={name} title={title} size={size} {...AvatarProps} />
        {isClose && (
          <span className={style.pop} onClick={onClick} data-id={`${dataId}_close`} data-test-id={`${dataId}_close`}>
            <span className={style.icon}>
              <Icon name='ZD-plus' />
            </span>
          </span>
        )}
      </div>
    );
  }
}
AvatarClose.propTypes = propTypes;
AvatarClose.defaultProps = defaultProps;
// if (__DOCS__) {
//   AvatarClose.docs = {
//     componentGroup: 'Avatar Group'
//   };
// }