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.

22 lines (18 loc) 2.63 kB
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import { rtlSpacing } from "../../../utils/rtl"; import { SIZE_OPTIONS, TOKENS } from "./consts"; var getSpacing = function getSpacing(onlyIcon, iconRight, iconLeft, size, theme) { var _TOKENS$paddingButton, _TOKENS$paddingButton2, _TOKENS$paddingButton3, _TOKENS$paddingButton4, _tokens; var wrappedRtl = function wrappedRtl(value) { return rtlSpacing(value)({ theme: theme }); }; if (onlyIcon) return wrappedRtl(theme.orbit.paddingButtonWithoutText); var tokens = (_tokens = {}, _defineProperty(_tokens, TOKENS.paddingButton, (_TOKENS$paddingButton = {}, _defineProperty(_TOKENS$paddingButton, SIZE_OPTIONS.LARGE, theme.orbit.paddingButtonLarge), _defineProperty(_TOKENS$paddingButton, SIZE_OPTIONS.NORMAL, theme.orbit.paddingButtonNormal), _defineProperty(_TOKENS$paddingButton, SIZE_OPTIONS.SMALL, theme.orbit.paddingButtonSmall), _TOKENS$paddingButton)), _defineProperty(_tokens, TOKENS.paddingButtonWithIcons, (_TOKENS$paddingButton2 = {}, _defineProperty(_TOKENS$paddingButton2, SIZE_OPTIONS.LARGE, theme.orbit.paddingButtonLargeWithIcons), _defineProperty(_TOKENS$paddingButton2, SIZE_OPTIONS.NORMAL, theme.orbit.paddingButtonNormalWithIcons), _defineProperty(_TOKENS$paddingButton2, SIZE_OPTIONS.SMALL, theme.orbit.paddingButtonSmallWithIcons), _TOKENS$paddingButton2)), _defineProperty(_tokens, TOKENS.paddingButtonWithLeftIcon, (_TOKENS$paddingButton3 = {}, _defineProperty(_TOKENS$paddingButton3, SIZE_OPTIONS.LARGE, theme.orbit.paddingButtonLargeWithLeftIcon), _defineProperty(_TOKENS$paddingButton3, SIZE_OPTIONS.NORMAL, theme.orbit.paddingButtonNormalWithLeftIcon), _defineProperty(_TOKENS$paddingButton3, SIZE_OPTIONS.SMALL, theme.orbit.paddingButtonSmallWithLeftIcon), _TOKENS$paddingButton3)), _defineProperty(_tokens, TOKENS.paddingButtonWithRightIcon, (_TOKENS$paddingButton4 = {}, _defineProperty(_TOKENS$paddingButton4, SIZE_OPTIONS.LARGE, theme.orbit.paddingButtonLargeWithRightIcon), _defineProperty(_TOKENS$paddingButton4, SIZE_OPTIONS.NORMAL, theme.orbit.paddingButtonNormalWithRightIcon), _defineProperty(_TOKENS$paddingButton4, SIZE_OPTIONS.SMALL, theme.orbit.paddingButtonSmallWithRightIcon), _TOKENS$paddingButton4)), _tokens); if (iconLeft && iconRight) return wrappedRtl(tokens[TOKENS.paddingButtonWithIcons][size]); if (iconLeft && !iconRight) return wrappedRtl(tokens[TOKENS.paddingButtonWithLeftIcon][size]); if (!iconLeft && iconRight) return wrappedRtl(tokens[TOKENS.paddingButtonWithRightIcon][size]); return wrappedRtl(tokens[TOKENS.paddingButton][size]); }; export default getSpacing;