左侧栏初步

This commit is contained in:
禺狨
2023-03-02 11:39:06 +08:00
parent 3dff7f139d
commit 37c5756866
17 changed files with 452 additions and 44 deletions

29
src/store/store.ts Normal file
View File

@@ -0,0 +1,29 @@
import { createStore } from "redux";
interface IAction {
type: string;
payload?: any;
}
interface IState {
isshow: boolean;
}
const reducer = (
preState: IState = {
isshow: false,
},
action: IAction
) => {
const { type } = action;
const newState = { ...preState };
switch (type) {
case "show":
newState.isshow = true;
return newState;
case "hidden":
newState.isshow = false;
return newState;
default:
return preState;
}
};
const store = createStore(reducer);
export default store;