All files / components buttons.js

88.89% Statements 8/9
100% Branches 2/2
75% Functions 3/4
100% Lines 8/8

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        1x   1x     2x 1x   1x 1x     2x                     1x              
import React, { Component } from 'react';
 
export class CustomButtons extends Component {
  render() {
        const {buttons, row} = this.props;
 
        return buttons.map((button, i) => {
            let innerButton;
 
            if (button.renderer) {
                innerButton = button.renderer(row.id);
            } else {
                const { type: iconType, name: iconName } = button.icon;
                innerButton = <span className={`${iconType} ${iconType}-${iconName}`} onClick={() => button.handler(row.id)} > {button.title} </span>;
            }
 
            return (
                <li className="list-inline-item" key={`${row.id}-${i}`}>
                    {innerButton}
                </li>
            );
        });
    }
}
 
export class TableButton extends Component {
  render() {
        return (
            <li className="list-inline-item" key={this.props.key}>
                <span className={this.props.className} onClick={this.props.onClick} />
            </li>
        );
    }
}