UNPKG

@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.

36 lines (27 loc) 1.11 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/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 = {}, (0, _defineProperty2.default)(_tokens, DURATIONS.SLOW, theme.orbit.durationSlow), (0, _defineProperty2.default)(_tokens, DURATIONS.NORMAL, theme.orbit.durationNormal), (0, _defineProperty2.default)(_tokens, DURATIONS.FAST, theme.orbit.durationFast), _tokens); return properties.map(function (property) { return "".concat(property, " ").concat(tokens[duration] || duration, " ").concat(timingFunction); }).join(","); }; }; var _default = transition; exports.default = _default;