diff --git a/src/components/Layout.js b/src/components/Layout.js
index 3ffa069..7681311 100644
--- a/src/components/Layout.js
+++ b/src/components/Layout.js
@@ -12,6 +12,14 @@ import {
Flex,
Link,
Image,
+ Drawer,
+ DrawerBody,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ DrawerContent,
+ DrawerCloseButton,
+ useDisclosure,
} from "@chakra-ui/react";
import { GiHamburgerMenu } from "@react-icons/all-files/gi/GiHamburgerMenu";
// import { BiSun } from "@react-icons/all-files/bi/BiSun";
@@ -20,11 +28,22 @@ import { useCore } from "@/providers/CoreProvider";
import ConnectWalletTag from "./ConnectWalletTag";
import { sidebarArr } from "@/utils/json";
import { webColor } from "@/theme/index";
+import { useEffect, useState } from "react";
const Layout = ({ children, currentApp }) => {
const { isSidebar, setIsSidebar } = useCore();
+ const [deviceIsMobile, setDeviceIsMobile] = useState(null);
+ const { isOpen, onOpen, onClose } = useDisclosure()
// const { colorMode, toggleColorMode } = useColorMode();
+ useEffect(() => {
+ if (window.innerWidth < 768) {
+ setDeviceIsMobile(true);
+ } else {
+ setDeviceIsMobile(false);
+ }
+ }, []);
+
const sidebarBG = useColorModeValue(
webColor.sidebarBg[0],
webColor.sidebarBg[1],
@@ -71,25 +90,25 @@ const Layout = ({ children, currentApp }) => {
color={defaultColor}
fontSize="16pt"
_hover={{ bg: "transparent", color: defaultColor }}
- onClick={() => setIsSidebar(!isSidebar)}
+ onClick={() => { deviceIsMobile === false ? setIsSidebar(!isSidebar) : onOpen() }}
>
- {/*
- {colorMode === 'light' ? : }
- */}
+ {/*
+ {colorMode === 'light' ? : }
+ */}
-
- {isSidebar && (
+
+ {isSidebar && deviceIsMobile === false && (
{
zIndex="1337 !important"
>
{sidebarArr?.map((item, idx) => (
-
- {item.parent.toUpperCase()}
-
+
+ {item.parent.toUpperCase()}
+
{item.items.map((nav, idx) => (
-
+
{!nav.isExternal ? (
)}
-
+
{nav.children.map((children, idx) => (
))}
@@ -201,11 +225,129 @@ const Layout = ({ children, currentApp }) => {
))}
)}
+ {deviceIsMobile &&
+ <>
+
+
+
+
+
+ {sidebarArr?.map((item, idx) => (
+
+ {item.parent.toUpperCase()}
+
+ {item.items.map((nav, idx) => (
+
+ {!nav.isExternal ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+ {nav.children.map((children, idx) => (
+
+
+
+ ))}
+
+
+ ))}
+
+
+ ))}
+
+
+
+ >
+ }