@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.
56 lines (45 loc) • 1.76 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _consts = require("../../primitives/ButtonPrimitive/common/consts");
var _getButtonTypeToken = _interopRequireDefault(require("./getButtonTypeToken"));
var _consts2 = require("../consts");
var _getButtonBoxShadow = _interopRequireDefault(require("./getButtonBoxShadow"));
const getButtonStyles = ({
disabled,
theme,
type
}) => {
const wrappedBoxShadow = state => (0, _getButtonBoxShadow.default)({
state,
disabled,
theme,
type
});
const wrappedTypeToken = name => (0, _getButtonTypeToken.default)({
name,
type,
theme
});
const boxShadow = {
boxShadow: wrappedBoxShadow(_consts.BUTTON_STATES.DEFAULT),
boxShadowHover: wrappedBoxShadow(_consts.BUTTON_STATES.HOVER),
boxShadowActive: wrappedBoxShadow(_consts.BUTTON_STATES.ACTIVE),
boxShadowFocus: wrappedBoxShadow(_consts.BUTTON_STATES.FOCUS)
};
return (0, _objectSpread2.default)({
background: wrappedTypeToken(_consts2.TOKENS.backgroundButton),
backgroundHover: wrappedTypeToken(_consts2.TOKENS.backgroundButtonHover),
backgroundActive: wrappedTypeToken(_consts2.TOKENS.backgroundButtonActive),
backgroundFocus: null,
foreground: wrappedTypeToken(_consts2.TOKENS.colorTextButton),
foregroundHover: wrappedTypeToken(_consts2.TOKENS.colorTextButtonHover),
foregroundActive: wrappedTypeToken(_consts2.TOKENS.colorTextButtonActive)
}, boxShadow);
};
var _default = getButtonStyles;
exports.default = _default;