@eintrek/erp-shell 0.1.40 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +14 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -459,10 +459,22 @@ function SidebarProvider({ children, defaultOpen = true, }) {
|
|
|
459
459
|
localStorage.setItem("sidebar-open", String(open));
|
|
460
460
|
}
|
|
461
461
|
}, [open]);
|
|
462
|
-
// Handle mobile detection
|
|
462
|
+
// Handle mobile detection.
|
|
463
|
+
//
|
|
464
|
+
// Crossing into a narrow viewport closes the sidebar. One `open` state
|
|
465
|
+
// serves both layouts, and on desktop it is remembered as true — so
|
|
466
|
+
// narrowing the window turned that into a drawer covering the whole page,
|
|
467
|
+
// which had to be dismissed before anything underneath could be reached.
|
|
468
|
+
// A remembered desktop preference is not a request to open a drawer.
|
|
463
469
|
React.useEffect(() => {
|
|
470
|
+
let wasMobile = null;
|
|
464
471
|
const checkMobile = () => {
|
|
465
|
-
|
|
472
|
+
const nowMobile = window.innerWidth < 768;
|
|
473
|
+
setIsMobile(nowMobile);
|
|
474
|
+
if (nowMobile && wasMobile === false) {
|
|
475
|
+
setOpenState(false);
|
|
476
|
+
}
|
|
477
|
+
wasMobile = nowMobile;
|
|
466
478
|
};
|
|
467
479
|
checkMobile();
|
|
468
480
|
window.addEventListener("resize", checkMobile);
|