refactor: redux migration - toggle menubar

This commit is contained in:
Anoop M D
2022-03-17 09:41:27 +05:30
parent 8b48a388ad
commit b46d3c5a9e
10 changed files with 260 additions and 46 deletions

View File

@@ -0,0 +1,21 @@
import { createSlice } from '@reduxjs/toolkit'
const initialState = {
leftMenuBarOpen: true,
leftSidebarWidth: 270
};
export const appSlice = createSlice({
name: 'app',
initialState,
reducers: {
toggleLeftMenuBar: (state) => {
state.leftMenuBarOpen = !state.leftMenuBarOpen;
state.leftSidebarWidth = state.leftMenuBarOpen ? 270 : 222;
}
}
});
export const { toggleLeftMenuBar } = appSlice.actions;
export default appSlice.reducer;