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.

46 lines (35 loc) 1.48 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _styledComponents = require("styled-components"); var _mediaQuery = _interopRequireDefault(require("../../utils/mediaQuery")); var _consts = _interopRequireDefault(require("../consts")); var computedWidth = function computedWidth(width, isPrefixed) { return "".concat(isPrefixed ? "-" : "").concat(width); }; var transitionCss = function transitionCss(_ref) { var width = _ref.width, shown = _ref.shown; return function (isPrefixed) { return (0, _styledComponents.css)(["transform:translate3d(", ");", ";"], shown ? "0, 0, 0" : "".concat(computedWidth("100%", isPrefixed), " , 0, 0"), _mediaQuery.default.largeMobile((0, _styledComponents.css)(["transform:translate3d(", ");"], shown ? "0, 0, 0" : "".concat(computedWidth(width, isPrefixed), " , 0, 0")))); }; }; var getTransitionAnimation = function getTransitionAnimation(_ref2) { var width = _ref2.width, shown = _ref2.shown, position = _ref2.position, theme = _ref2.theme; var resultCss = transitionCss({ width: width, shown: shown }); if (position === _consts.default.RIGHT && !theme.rtl || position === _consts.default.LEFT && theme.rtl) { return resultCss(false); } return resultCss(true); }; var _default = getTransitionAnimation; exports.default = _default;