@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.
104 lines (102 loc) • 5.97 kB
JavaScript
import { convertHexToRgba } from "@kiwicom/orbit-design-tokens";
import { TOKENS, TYPE_OPTIONS } from "../consts";
const getButtonTypeToken = ({
name,
type,
theme
}) => {
const tokens = {
[]: {
[]: theme.orbit.backgroundButtonPrimary,
[]: theme.orbit.backgroundButtonSecondary,
[]: theme.orbit.backgroundButtonCritical,
[]: theme.orbit.backgroundButtonWhite,
[]: theme.orbit.paletteProductLight,
[]: theme.orbit.paletteRedLight,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryHover,
[]: theme.orbit.backgroundButtonSecondaryHover,
[]: theme.orbit.backgroundButtonCriticalHover,
[]: theme.orbit.backgroundButtonWhiteHover,
[]: theme.orbit.paletteProductLightHover,
[]: theme.orbit.paletteRedLightHover,
[]: theme.orbit.backgroundButtonBundleBasicHover,
[]: theme.orbit.backgroundButtonBundleMediumHover,
[]: theme.orbit.backgroundButtonBundleTopHover
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryActive,
[]: theme.orbit.backgroundButtonSecondaryActive,
[]: theme.orbit.backgroundButtonCriticalActive,
[]: theme.orbit.backgroundButtonWhiteActive,
[]: theme.orbit.paletteProductLightActive,
[]: theme.orbit.paletteRedLightActive,
[]: theme.orbit.backgroundButtonBundleBasicActive,
[]: theme.orbit.backgroundButtonBundleMediumActive,
[]: theme.orbit.backgroundButtonBundleTopActive
},
[]: {
[]: convertHexToRgba(theme.orbit.paletteProductNormal, 10),
[]: convertHexToRgba(theme.orbit.paletteInkLight, 10),
[]: convertHexToRgba(theme.orbit.paletteRedNormal, 10),
[]: convertHexToRgba(theme.orbit.paletteWhite, 20),
[]: theme.orbit.paletteProductLight,
[]: theme.orbit.paletteRedLight,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.colorTextButtonPrimary,
[]: theme.orbit.colorTextButtonSecondary,
[]: theme.orbit.colorTextButtonCritical,
[]: theme.orbit.colorTextButtonWhite,
[]: theme.orbit.paletteProductNormal,
[]: theme.orbit.paletteRedNormal,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryHover,
[]: theme.orbit.colorTextButtonSecondaryHover,
[]: theme.orbit.colorTextButtonCriticalHover,
[]: theme.orbit.colorTextButtonWhiteHover,
[]: theme.orbit.paletteProductDark,
[]: theme.orbit.paletteRedDark,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryActive,
[]: theme.orbit.colorTextButtonSecondaryActive,
[]: theme.orbit.colorTextButtonCriticalActive,
[]: theme.orbit.colorTextButtonWhiteActive,
[]: theme.orbit.paletteProductDark,
[]: theme.orbit.paletteRedDark,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: convertHexToRgba(theme.orbit.paletteProductNormal, 50),
[]: convertHexToRgba(theme.orbit.paletteInkLight, 30),
[]: convertHexToRgba(theme.orbit.paletteRedNormal, 50),
// because it's not possible to see outline on the white bg, we use active token
[]: convertHexToRgba(theme.orbit.paletteWhiteActive, 50),
[]: convertHexToRgba(theme.orbit.paletteProductNormal, 50),
[]: convertHexToRgba(theme.orbit.paletteRedNormal, 50),
// TODO: currently we do not have tokens for these colors
[]: convertHexToRgba(`
[]: convertHexToRgba(`
[]: convertHexToRgba(`
}
};
return tokens[name][type];
};
export default getButtonTypeToken;