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.

34 lines (28 loc) 1.11 kB
import { css } from "styled-components"; import mq from "../../utils/mediaQuery"; import POSITIONS from "../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 css(["transform:translate3d(", ");", ";"], shown ? "0, 0, 0" : "".concat(computedWidth("100%", isPrefixed), " , 0, 0"), mq.largeMobile(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 === POSITIONS.RIGHT && !theme.rtl || position === POSITIONS.LEFT && theme.rtl) { return resultCss(false); } return resultCss(true); }; export default getTransitionAnimation;