# All files / elements/Button utils.js

100% Statements 16/16
100% Branches 14/14
100% Functions 3/3
100% Lines 16/16

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

    7x
    514x
    500x

    14x

    7x
    257x
    257x
    7x

    250x
    250x

    7x
    257x
    257x
    7x

    250x
    250x

     import { resolveColor } from 'src/utils/styledHelpers';

    const hasVariant = variant => {
      if (!variant) {
        return false;
      }
      return !!variant;
    };

    export const activeColorButton = props => {
      const { bgActiveColor, variant } = props;
      if (hasVariant(variant)) {
        return null;
      }
      const color = (!bgActiveColor || bgActiveColor === null) ? resolveColor('white.light') : resolveColor(bgActiveColor);
      return `background-color: ${color}`;
    };

    export const hoverColorButton = props => {
      const { bgHoverColor, variant } = props;
      if (hasVariant(variant)) {
        return null;
      }
      const color = (!bgHoverColor || bgHoverColor === null) ? resolveColor('white.dark') : resolveColor(bgHoverColor);
      return `background-color: ${color}`;
    };