@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
26 lines (25 loc) • 712 B
JavaScript
import { keyframes, css } from "styled-components";
export const resolveValue = value => {
if (typeof value === "string") return value;
if (typeof value === "number") return `${value}px`;
return "100%";
};
export const resolveHeight = ({
calculatedHeight,
height
}) => {
if (calculatedHeight) return `${calculatedHeight}px`;
if (height) return resolveValue(height);
return "100%";
};
const pulseAnimation = keyframes(["0%{opacity:1;}50%{opacity:0.3;}100%{opacity:1;}"]);
export const resolvePulseAnimation = ({
animate,
duration,
interval
}) => {
if (animate) {
return css(["animation:", " ", " ease-in-out ", " infinite;"], pulseAnimation, duration, interval);
}
return null;
};