All files / src/lookup/EmptyPage EmptyPage.js

66.66% Statements 8/12
20% Branches 1/5
100% Functions 3/3
66.66% Lines 8/12

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                            1x 1x       1x   1x                                 1x 1x                 1x   1x              
/*** Libraries ***/
import React, { Component } from 'react';
import { defaultProps } from './props/defaultProps';
import { propTypes } from './props/propTypes';
 
import EmptySearch from '@zohodesk/svg/lib/emptystate/version3/EmptySearch';
import EmptyAccounts from '@zohodesk/svg/lib/emptystate/version3/EmptyAccounts';
import EmptyContact from '@zohodesk/svg/lib/emptystate/version3/EmptyContact';
import EmptyProducts from '@zohodesk/svg/lib/emptystate/version3/EmptyProducts';
/*** CSS ***/
import style from './LookupEmptyPage.module.css';
 
export default class EmptyPage extends Component {
  constructor(props) {
    super(props);
    this.renderEmptyState = this.renderEmptyState.bind();
  }
 
  renderEmptyState(type) {
    switch (type) {
      case 'search':
        return <EmptySearch className={style.image} />;
 
      case 'account':
        return <EmptyAccounts className={style.image} />;
 
      case 'contact':
        return <EmptyContact className={style.image} />;
 
      case 'product':
        return <EmptyProducts className={style.image} />;
 
      default:
        return null;
    }
  }
 
  render() {
    let { type, title } = this.props;
    return (
      <div className={style.container} data-id={`empty_${type}`} data-test-id={`empty_${type}`}>
        {this.renderEmptyState(type)}
        <div className={style.contentDiv}>{title}</div>
      </div>
    );
  }
}
 
EmptyPage.propTypes = propTypes;
 
EmptyPage.defaultProps = defaultProps;
 
// if (__DOCS__) {
//   EmptyPage.docs = {
//     componentGroup: 'Lookup'
//   };
// }