Skip to content

Commit

Permalink
feat: keep sidebar closed after page change
Browse files Browse the repository at this point in the history
  • Loading branch information
mamadoudicko committed Dec 13, 2023
1 parent c31825a commit 6fae24e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions frontend/lib/context/SidebarProvider/sidebar-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { usePathname } from "next/navigation";
import { createContext, useEffect, useState } from "react";

import { useDevice } from "@/lib/hooks/useDevice";
Expand All @@ -19,11 +18,10 @@ export const SideBarProvider = ({
}): JSX.Element => {
const { isMobile } = useDevice();
const [isOpened, setIsOpened] = useState(!isMobile);
const pathname = usePathname();

useEffect(() => {
setIsOpened(!isMobile);
}, [isMobile, pathname]);
}, [isMobile]);

return (
<SideBarContext.Provider
Expand Down

0 comments on commit 6fae24e

Please sign in to comment.