All files / src/setup/header/Views Views.js

100% Statements 5/5
50% Branches 4/8
100% Functions 2/2
100% Lines 5/5

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              1x       1x 1x                                       1x 1x                
import React from 'react';
import { defaultProps } from './props/defaultProps';
import { propTypes } from './props/propTypes';
import style from './Views.module.css';
import { Icon } from '@zohodesk/icons';
export default class Views extends React.Component {
  constructor(props) {
    super(props);
  }
 
  render() {
    let { isGrid, isList, gridTitle, listTitle, onListClick, onGridClick } = this.props;
    return (
      <span className={style.container}>
        <span
          className={`${style.icon} ${style.first} ${isList ? style.active : ''}`}
          data-title={!isList ? listTitle : null}
          onClick={onListClick}
        >
          <Icon name='ZD-list22' size='10' />
        </span>
        <span
          className={`${style.icon} ${style.last}  ${isGrid ? style.active : ''}`}
          data-title={!isGrid ? gridTitle : null}
          onClick={onGridClick}
        >
          <Icon name='ZD-grid' size='11' />
        </span>
      </span>
    );
  }
}
Views.propTypes = propTypes;
Views.defaultProps = defaultProps;
 
// if (__DOCS__) {
//   Views.docs = {
//     componentGroup: 'Header',
//     folderName: 'Setup'
//   };
// }