@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.esm.js
CHANGED
|
@@ -440,10 +440,22 @@ function SidebarProvider({ children, defaultOpen = true, }) {
|
|
|
440
440
|
localStorage.setItem("sidebar-open", String(open));
|
|
441
441
|
}
|
|
442
442
|
}, [open]);
|
|
443
|
-
// Handle mobile detection
|
|
443
|
+
// Handle mobile detection.
|
|
444
|
+
//
|
|
445
|
+
// Crossing into a narrow viewport closes the sidebar. One `open` state
|
|
446
|
+
// serves both layouts, and on desktop it is remembered as true — so
|
|
447
|
+
// narrowing the window turned that into a drawer covering the whole page,
|
|
448
|
+
// which had to be dismissed before anything underneath could be reached.
|
|
449
|
+
// A remembered desktop preference is not a request to open a drawer.
|
|
444
450
|
useEffect(() => {
|
|
451
|
+
let wasMobile = null;
|
|
445
452
|
const checkMobile = () => {
|
|
446
|
-
|
|
453
|
+
const nowMobile = window.innerWidth < 768;
|
|
454
|
+
setIsMobile(nowMobile);
|
|
455
|
+
if (nowMobile && wasMobile === false) {
|
|
456
|
+
setOpenState(false);
|
|
457
|
+
}
|
|
458
|
+
wasMobile = nowMobile;
|
|
447
459
|
};
|
|
448
460
|
checkMobile();
|
|
449
461
|
window.addEventListener("resize", checkMobile);
|