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.

41 lines (39 loc) 1.55 kB
import convertHexToRgba from "@kiwicom/orbit-design-tokens/lib/convertHexToRgba"; import { TOKENS, TYPES } from "../consts"; const getTypeToken = name => ({ theme, type }) => { const tokens = { [TOKENS.backgroundButton]: { [TYPES.PRIMARY]: theme.orbit.backgroundButtonLinkPrimary, [TYPES.SECONDARY]: theme.orbit.backgroundButtonLinkSecondary }, [TOKENS.backgroundButtonHover]: { [TYPES.PRIMARY]: theme.orbit.backgroundButtonLinkPrimaryHover, [TYPES.SECONDARY]: theme.orbit.backgroundButtonLinkSecondaryHover }, [TOKENS.backgroundButtonActive]: { [TYPES.PRIMARY]: theme.orbit.backgroundButtonLinkPrimaryHover, [TYPES.SECONDARY]: theme.orbit.backgroundButtonLinkSecondaryHover }, [TOKENS.colorTextButton]: { [TYPES.PRIMARY]: theme.orbit.colorTextButtonLinkPrimary, [TYPES.SECONDARY]: theme.orbit.colorTextButtonLinkSecondary }, [TOKENS.colorTextButtonHover]: { [TYPES.PRIMARY]: theme.orbit.colorTextButtonLinkPrimaryHover, [TYPES.SECONDARY]: theme.orbit.colorTextButtonLinkSecondaryHover }, [TOKENS.colorTextButtonActive]: { [TYPES.PRIMARY]: theme.orbit.colorTextButtonLinkPrimaryActive, [TYPES.SECONDARY]: theme.orbit.colorTextButtonLinkSecondaryActive }, [TOKENS.backgroundButtonFocus]: { [TYPES.PRIMARY]: convertHexToRgba(theme.orbit.paletteProductNormal, 10), [TYPES.SECONDARY]: convertHexToRgba(theme.orbit.paletteInkLight, 10) } }; return tokens[name][type]; }; export default getTypeToken;