All files / elements/Progress/utils styledHelpers.js

100% Statements 11/11
100% Branches 4/4
100% Functions 3/3
100% Lines 9/9

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          17x       1221x 1221x 1x   1220x 1219x   1x     1228x       17x                    
import { css } from 'styled-components';
import { system } from 'styled-system';
import { resolveColor } from 'src/utils/styledHelpers';
import { getGlobalOverrides } from 'src/global-styles';
 
export const getAnimationIterationCount = props => {
  const {
    animationIterationCount,
    loop,
  } = props;
  if (animationIterationCount) {
    return animationIterationCount;
  }
  if (loop) {
    return 'infinite';
  }
  return 1;
};
 
export const makeColorResolver = (styleName, propName) => props => ({
  [styleName]: resolveColor(props[propName], getGlobalOverrides(props)),
});
 
export const styledSystemAnimation = css`
  ${system({ animationDuration: true })}
  ${system({ animationTimingFunction: true })}
  ${system({ animationDelay: true })}
  ${system({ animationIterationCount: true })}
  ${system({ animationDirection: true })}
  ${system({ animationFillMode: true })}
  ${system({ animationPlayState: true })}
  ${system({ animation: true })}
`;