Close settings sidebar on window resize (#4662)
This commit is contained in:
1 parent
9ddbaf0966
commit
f9ef883f3d
1 file changed
+14
@@ -296,6 +296,20 @@ export default function SettingsLayout({
|
||||
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
|
||||
const state = useState(false);
|
||||
const [sideContainerOpen, setSideContainerOpen] = state;
|
||||
|
||||
useEffect(() => {
|
||||
const closeSideContainer = () => {
|
||||
if (window.innerWidth >= 1024) {
|
||||
setSideContainerOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("resize", closeSideContainer);
|
||||
return () => {
|
||||
window.removeEventListener("resize", closeSideContainer);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Shell
|
||||
flexChildrenContainer
|
||||
|
||||
Reference in new issue
Block a user