@open-tender/cloud
Version:
A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.
24 lines (23 loc) • 866 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sidebarModalReducer = exports.selectSidebarModal = exports.toggleSidebarModal = void 0;
const toolkit_1 = require("@reduxjs/toolkit");
const initialState = {
isOpen: false
};
const sidebarModalSlice = (0, toolkit_1.createSlice)({
name: 'sidebarModal',
initialState,
reducers: {
toggleSidebarModal: state => {
state.isOpen = !state.isOpen;
state.isOpen
? document.body.classList.add('has-modal')
: document.body.classList.remove('has-modal');
}
}
});
exports.toggleSidebarModal = sidebarModalSlice.actions.toggleSidebarModal;
const selectSidebarModal = (state) => state.sidebarModal;
exports.selectSidebarModal = selectSidebarModal;
exports.sidebarModalReducer = sidebarModalSlice.reducer;