@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.
113 lines (108 loc) • 7.04 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _orbitDesignTokens = require("@kiwicom/orbit-design-tokens");
var _consts = require("../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
},
[]: {
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 10),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteInkLight, 10),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 10),
[]: (0, _orbitDesignTokens.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
},
[]: {
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteInkLight, 30),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 50),
// because it's not possible to see outline on the white bg, we use active token
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteWhiteActive, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteProductNormal, 50),
[]: (0, _orbitDesignTokens.convertHexToRgba)(theme.orbit.paletteRedNormal, 50),
// TODO: currently we do not have tokens for these colors
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
[]: (0, _orbitDesignTokens.convertHexToRgba)(`
}
};
return tokens[name][type];
};
var _default = getButtonTypeToken;
exports.default = _default;