@layerswap/widget 0.1.15 → 0.1.17-beta.6

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.
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
+ import AppSettings from "../lib/AppSettings";
2
3
  export default function useWindowDimensions() {
3
4
  const [windowSize, setWindowSize] = useState({
4
5
  width: undefined,
@@ -20,9 +21,12 @@ export default function useWindowDimensions() {
20
21
  // Remove event listener on cleanup
21
22
  return () => window.removeEventListener("resize", handleResize);
22
23
  }, []); // Empty array ensures that effect is only run on mount
24
+ const isMobile = typeof windowSize?.width === "number" && windowSize?.width < 768;
25
+ const isDesktop = typeof windowSize?.width === "number" && windowSize?.width >= 768;
23
26
  return {
24
27
  windowSize,
25
- isMobile: typeof windowSize?.width === "number" && windowSize?.width < 768,
26
- isDesktop: typeof windowSize?.width === "number" && windowSize?.width >= 768,
28
+ isMobile,
29
+ isMobileWithPortal: isMobile && AppSettings.ThemeData?.enablePortal == true,
30
+ isDesktop
27
31
  };
28
32
  }