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.

53 lines (42 loc) 3.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _consts = require("../consts"); var _rtl = require("../../utils/rtl"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var getButtonLinkSpacing = function getButtonLinkSpacing() { return function (_ref) { var _TOKENS$paddingButton, _TOKENS$paddingButton2, _TOKENS$paddingButton3, _TOKENS$paddingButton4, _tokens; var theme = _ref.theme, onlyIcon = _ref.onlyIcon, iconRight = _ref.iconRight, iconLeft = _ref.iconLeft, size = _ref.size; if (onlyIcon) return (0, _rtl.rtlSpacing)(theme.orbit.paddingButtonWithoutText)({ theme: theme }); var tokens = (_tokens = {}, _defineProperty(_tokens, _consts.TOKENS.paddingButton, (_TOKENS$paddingButton = {}, _defineProperty(_TOKENS$paddingButton, _consts.SIZES.LARGE, theme.orbit.paddingButtonLarge), _defineProperty(_TOKENS$paddingButton, _consts.SIZES.NORMAL, theme.orbit.paddingButtonNormal), _defineProperty(_TOKENS$paddingButton, _consts.SIZES.SMALL, theme.orbit.paddingButtonSmall), _TOKENS$paddingButton)), _defineProperty(_tokens, _consts.TOKENS.paddingButtonWithIcons, (_TOKENS$paddingButton2 = {}, _defineProperty(_TOKENS$paddingButton2, _consts.SIZES.LARGE, theme.orbit.paddingButtonLargeWithIcons), _defineProperty(_TOKENS$paddingButton2, _consts.SIZES.NORMAL, theme.orbit.paddingButtonNormalWithIcons), _defineProperty(_TOKENS$paddingButton2, _consts.SIZES.SMALL, theme.orbit.paddingButtonSmallWithIcons), _TOKENS$paddingButton2)), _defineProperty(_tokens, _consts.TOKENS.paddingButtonWithLeftIcon, (_TOKENS$paddingButton3 = {}, _defineProperty(_TOKENS$paddingButton3, _consts.SIZES.LARGE, theme.orbit.paddingButtonLargeWithLeftIcon), _defineProperty(_TOKENS$paddingButton3, _consts.SIZES.NORMAL, theme.orbit.paddingButtonNormalWithLeftIcon), _defineProperty(_TOKENS$paddingButton3, _consts.SIZES.SMALL, theme.orbit.paddingButtonSmallWithLeftIcon), _TOKENS$paddingButton3)), _defineProperty(_tokens, _consts.TOKENS.paddingButtonWithRightIcon, (_TOKENS$paddingButton4 = {}, _defineProperty(_TOKENS$paddingButton4, _consts.SIZES.LARGE, theme.orbit.paddingButtonLargeWithRightIcon), _defineProperty(_TOKENS$paddingButton4, _consts.SIZES.NORMAL, theme.orbit.paddingButtonNormalWithRightIcon), _defineProperty(_TOKENS$paddingButton4, _consts.SIZES.SMALL, theme.orbit.paddingButtonSmallWithRightIcon), _TOKENS$paddingButton4)), _tokens); if (iconLeft && iconRight) { return (0, _rtl.rtlSpacing)(tokens[_consts.TOKENS.paddingButtonWithIcons][size])({ theme: theme }); } if (iconLeft && !iconRight) { return (0, _rtl.rtlSpacing)(tokens[_consts.TOKENS.paddingButtonWithLeftIcon][size])({ theme: theme }); } if (!iconLeft && iconRight) { return (0, _rtl.rtlSpacing)(tokens[_consts.TOKENS.paddingButtonWithRightIcon][size])({ theme: theme }); } return (0, _rtl.rtlSpacing)(tokens[_consts.TOKENS.paddingButton][size])({ theme: theme }); }; }; var _default = getButtonLinkSpacing; exports.default = _default;