@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.
102 lines • 6.17 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.backgroundButtonPrimarySubtle,
[]: theme.orbit.backgroundButtonCriticalSubtle,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryHover,
[]: theme.orbit.backgroundButtonSecondaryHover,
[]: theme.orbit.backgroundButtonCriticalHover,
[]: theme.orbit.backgroundButtonWhiteHover,
[]: theme.orbit.backgroundButtonPrimarySubtleHover,
[]: theme.orbit.backgroundButtonCriticalSubtleHover,
[]: theme.orbit.backgroundButtonBundleBasicHover,
[]: theme.orbit.backgroundButtonBundleMediumHover,
[]: theme.orbit.backgroundButtonBundleTopHover
},
[]: {
[]: theme.orbit.backgroundButtonPrimaryActive,
[]: theme.orbit.backgroundButtonSecondaryActive,
[]: theme.orbit.backgroundButtonCriticalActive,
[]: theme.orbit.backgroundButtonWhiteActive,
[]: theme.orbit.backgroundButtonPrimarySubtleActive,
[]: theme.orbit.backgroundButtonCriticalSubtleActive,
[]: theme.orbit.backgroundButtonBundleBasicActive,
[]: theme.orbit.backgroundButtonBundleMediumActive,
[]: theme.orbit.backgroundButtonBundleTopActive
},
[]: {
[]: convertHexToRgba(theme.orbit.paletteProductNormal, 10),
[]: convertHexToRgba(theme.orbit.paletteInkNormal, 10),
[]: convertHexToRgba(theme.orbit.paletteRedNormal, 10),
[]: convertHexToRgba(theme.orbit.paletteWhite, 20),
[]: theme.orbit.backgroundButtonPrimarySubtleFocus,
[]: theme.orbit.backgroundButtonCriticalSubtleFocus,
[]: theme.orbit.backgroundButtonBundleBasic,
[]: theme.orbit.backgroundButtonBundleMedium,
[]: theme.orbit.backgroundButtonBundleTop
},
[]: {
[]: theme.orbit.colorTextButtonPrimary,
[]: theme.orbit.colorTextButtonSecondary,
[]: theme.orbit.colorTextButtonCritical,
[]: theme.orbit.colorTextButtonWhite,
[]: theme.orbit.colorTextButtonPrimarySubtle,
[]: theme.orbit.colorTextButtonCriticalSubtle,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryHover,
[]: theme.orbit.colorTextButtonSecondaryHover,
[]: theme.orbit.colorTextButtonCriticalHover,
[]: theme.orbit.colorTextButtonWhiteHover,
[]: theme.orbit.colorTextButtonPrimarySubtleHover,
[]: theme.orbit.colorTextButtonCriticalSubtleHover,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: theme.orbit.colorTextButtonPrimaryActive,
[]: theme.orbit.colorTextButtonSecondaryActive,
[]: theme.orbit.colorTextButtonCriticalActive,
[]: theme.orbit.colorTextButtonWhiteActive,
[]: theme.orbit.colorTextButtonPrimarySubtleActive,
[]: theme.orbit.colorTextButtonCriticalSubtleActive,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite,
[]: theme.orbit.paletteWhite
},
[]: {
[]: convertHexToRgba(theme.orbit.paletteProductNormal, 50),
[]: convertHexToRgba(theme.orbit.paletteInkNormal, 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;