refactor: filter store (#1331)

This commit is contained in:
boojack
2023-03-11 09:13:54 +08:00
committed by GitHub
parent f3f0efba1e
commit a9218ed5f0
23 changed files with 215 additions and 327 deletions

View File

@ -5,8 +5,10 @@ import ShortcutList from "./ShortcutList";
import TagList from "./TagList";
import SearchBar from "./SearchBar";
import UsageHeatMap from "./UsageHeatMap";
import { useLocation } from "react-router-dom";
const HomeSidebar = () => {
const location = useLocation();
const layoutStore = useLayoutStore();
const showHomeSidebar = layoutStore.state.showHomeSidebar;
@ -20,7 +22,7 @@ const HomeSidebar = () => {
};
window.addEventListener("resize", handleWindowResize);
handleWindowResize();
}, []);
}, [location]);
return (
<div
@ -35,7 +37,7 @@ const HomeSidebar = () => {
onClick={() => layoutStore.setHomeSidebarStatus(false)}
></div>
<aside
className={`absolute md:relative top-0 right-0 w-56 pr-2 md:w-full h-full max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start py-4 z-30 bg-white dark:bg-zinc-800 md:bg-transparent md:shadow-none transition-all duration-300 translate-x-full md:translate-x-0 ${
className={`absolute md:relative top-0 right-0 w-56 pr-2 md:w-full h-full max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start py-4 z-30 bg-zinc-100 dark:bg-zinc-800 md:bg-transparent md:shadow-none transition-all duration-300 translate-x-full md:translate-x-0 ${
showHomeSidebar && "!translate-x-0 shadow-2xl"
}`}
>