@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) • 651 B
JavaScript
import { SIZE_OPTIONS, TOKENS } from "../consts";
import { rtlSpacing } from "../../utils/rtl/index";
const getIconSpacing = () => ({
theme,
right,
size,
onlyIcon
}) => {
if (onlyIcon) {
return null;
}
const tokens = {
[TOKENS.marginRightIcon]: {
[SIZE_OPTIONS.LARGE]: theme.orbit.marginButtonIconLarge,
[SIZE_OPTIONS.NORMAL]: theme.orbit.marginButtonIconNormal,
[SIZE_OPTIONS.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;