cosmo-ui
Version:
Common React components
24 lines • 871 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var constants_1 = require("../constants");
exports.initiaDrawerState = {};
exports.drawerReducer = function (state, action) {
if (state === void 0) { state = exports.initiaDrawerState; }
switch (action.type) {
case constants_1.OPEN_DRAWER: {
return tslib_1.__assign({}, state, (_a = {}, _a[action.key] = true, _a));
}
case constants_1.CLOSE_DRAWER: {
return tslib_1.__assign({}, state, (_b = {}, _b[action.key] = false, _b));
}
case constants_1.TOGGLE_DRAWER: {
return tslib_1.__assign({}, state, (_c = {}, _c[action.key] = !state[action.key], _c));
}
default: {
return state;
}
}
var _a, _b, _c;
};
//# sourceMappingURL=drawer.js.map