# All files / components/Table/styles TableBody.js

50% Statements 2/4
0% Branches 0/8
0% Functions 0/2
50% Lines 2/4

    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

    4x

    4x

     import styled from 'styled-components';
    import get from 'extensions/themeGet';

    const TableBody = styled.tbody`
      & > tr {
        &:nth-child(odd) {
          background: ${props =>
            props.zebraStripe && props.startIndex % 2 === 1
              ? get('colors.shadow.extraLight')(props)
              : 'transparent'};
        }

        &:nth-child(even) {
          background: ${props =>
            props.zebraStripe
              ? props.startIndex % 2 === 1
                ? 'transparent'
                : get('colors.shadow.extraLight')(props)
              : 'transparent'};
        }
      }
    `;

    TableBody.defaultProps = {
      zebraStripe: true,
      startIndex: 0,
    };

    export default TableBody;