Create reducers for leftSidebar
This commit is contained in:
parent
0de4832993
commit
2f143ccfb1
|
@ -28,8 +28,18 @@ const leftSidebarSlice = createSlice({
|
||||||
name: 'leftSidebar',
|
name: 'leftSidebar',
|
||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
|
toggleButtonSelection: (state, action: PayloadAction<string>) => {
|
||||||
|
state.buttons.forEach(button => {
|
||||||
|
button.isSelected = button.id === action.payload;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toggleDot: (state, action: PayloadAction<string>) => {
|
||||||
|
const button = state.buttons.find(button => button.id === action.payload);
|
||||||
|
if (button) button.isDotOn = !button.isDotOn;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const { toggleButtonSelection, toggleDot } = leftSidebarSlice.actions;
|
export const { toggleButtonSelection, toggleDot } = leftSidebarSlice.actions;
|
||||||
|
|
||||||
|
export default leftSidebarSlice.reducer;
|
||||||
|
|
Loading…
Reference in New Issue