@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.
25 lines (20 loc) • 817 B
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
var DURATIONS = {
SLOW: "slow",
NORMAL: "normal",
FAST: "fast"
};
var transition = function transition(properties, duration, timingFunction) {
return function (_ref) {
var _tokens;
var theme = _ref.theme;
if (theme.transitions === false) {
return null;
}
var tokens = (_tokens = {}, _defineProperty(_tokens, DURATIONS.SLOW, theme.orbit.durationSlow), _defineProperty(_tokens, DURATIONS.NORMAL, theme.orbit.durationNormal), _defineProperty(_tokens, DURATIONS.FAST, theme.orbit.durationFast), _tokens);
return properties.map(function (property) {
return "".concat(property, " ").concat(tokens[duration] || duration, " ").concat(timingFunction);
}).join(",");
};
};
export default transition;