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.

26 lines (23 loc) 617 B
import { SIZES, TOKENS } from "../consts"; import { rtlSpacing } from "../../utils/rtl"; const getIconSpacing = () => ({ theme, right, size, onlyIcon }) => { if (onlyIcon) { return null; } const tokens = { [TOKENS.marginRightIcon]: { [SIZES.LARGE]: theme.orbit.marginButtonIconLarge, [SIZES.NORMAL]: theme.orbit.marginButtonIconNormal, [SIZES.SMALL]: theme.orbit.marginButtonIconSmall } }; return rtlSpacing(right ? `0 0 0 ${tokens[TOKENS.marginRightIcon][size]}` : `0 ${tokens[TOKENS.marginRightIcon][size]} 0 0`)({ theme }); }; export default getIconSpacing;