@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.
39 lines (33 loc) • 1.33 kB
JavaScript
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { TOKENS, TYPES } from "../consts";
import getButtonLinkTypeToken from "./getButtonLinkTypeToken";
const getButtonLinkStyles = ({
type,
theme,
compact
}) => {
const wrappedTypeToken = name => getButtonLinkTypeToken(name, type, theme);
const commonStyles = {
background: wrappedTypeToken(TOKENS.background),
foreground: wrappedTypeToken(TOKENS.foreground),
foregroundHover: wrappedTypeToken(TOKENS.foregroundHover),
foregroundActive: wrappedTypeToken(TOKENS.foregroundActive),
foregroundFocus: wrappedTypeToken(TOKENS.foregroundActive)
};
if (compact) {
if (type === TYPES.SECONDARY) {
return _objectSpread(_objectSpread({}, commonStyles), {}, {
foregroundHover: theme.orbit.colorTextButtonLinkSecondaryCompactHover,
foregroundActive: theme.orbit.colorTextButtonLinkSecondaryCompactHover,
foregroundFocus: theme.orbit.colorTextButtonLinkSecondaryCompactActive
});
}
return commonStyles;
}
return _objectSpread({
backgroundHover: wrappedTypeToken(TOKENS.backgroundHover),
backgroundActive: wrappedTypeToken(TOKENS.backgroundActive),
backgroundFocus: wrappedTypeToken(TOKENS.backgroundActive)
}, commonStyles);
};
export default getButtonLinkStyles;