All files / src/version2/alertIcons AlertIcons.js

100% Statements 6/6
100% Branches 3/3
100% Functions 1/1
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                          6x                                                       5x 5x 5x             6x 6x                
import React, { Component } from 'react';
import { AlertIcons_defaultProps } from './props/defaultProps';
import { AlertIcons_propTypes } from './props/propTypes';
 
import DangerAlertIcon from './DangerAlertIcon';
import SuccessAlertIcon from './SuccessAlertIcon';
import WarningAlertIcon from './WarningAlertIcon';
import InfoAlertIcon from './InfoAlertIcon';
import NotificationAlertIcon from './NotificationAlertIcon';
import AlarmAlertIcon from './AlarmAlertIcon';
 
import style from './AlertIcons.module.css';
 
let alertIconsObject = {
  success: {
    AlertIcon: SuccessAlertIcon
  },
  error: {
    AlertIcon: DangerAlertIcon
  },
  danger: {
    AlertIcon: DangerAlertIcon
  },
  warning: {
    AlertIcon: WarningAlertIcon
  },
  info: {
    AlertIcon: InfoAlertIcon
  },
  notification: {
    AlertIcon: NotificationAlertIcon
  },
  alarm: {
    AlertIcon: AlarmAlertIcon
  },
  primary: {
    AlertIcon: InfoAlertIcon
}
};
export default class AlertIcons extends Component {
  render() {
    let { type, variant, dataSelectorId } = this.props;
    let { AlertIcon = DangerAlertIcon } = alertIconsObject[type] || {};
    return (
      <div className={style.iconContainer} data-selector-id={dataSelectorId}>
        <AlertIcon variant={variant} type={type} />
      </div>
    );
  }
}
AlertIcons.propTypes = AlertIcons_propTypes;
AlertIcons.defaultProps = AlertIcons_defaultProps;
 
// if (__DOCS__) {
//   AlertIcons.docs = {
//     componentGroup: 'AlertIcons',
//     folderName: 'Alert'
//   };
// }