Port a13b33d85131e3e65cfc71894672cb2b15c89c51 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
29 lines
574 B
TypeScript
29 lines
574 B
TypeScript
import { createReducer } from '@reduxjs/toolkit';
|
|
|
|
import {
|
|
openNavigation,
|
|
closeNavigation,
|
|
toggleNavigation,
|
|
} from 'flavours/glitch/actions/navigation';
|
|
|
|
interface State {
|
|
open: boolean;
|
|
}
|
|
|
|
const initialState: State = {
|
|
open: false,
|
|
};
|
|
|
|
export const navigationReducer = createReducer(initialState, (builder) => {
|
|
builder
|
|
.addCase(openNavigation, (state) => {
|
|
state.open = true;
|
|
})
|
|
.addCase(closeNavigation, (state) => {
|
|
state.open = false;
|
|
})
|
|
.addCase(toggleNavigation, (state) => {
|
|
state.open = !state.open;
|
|
});
|
|
});
|