"use client" import { ActionIcon, Drawer, Group, SimpleGrid, Stack, Text, } from "@mantine/core"; import { IconX } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { AccentColor } from "../color/color_pallet"; import ComponentGlobal_Loader from "../component/loader"; interface MODEL_DRAWER { id: string; name: string; icon: string; path: string; } export default function UIGlobal_Drawer({ opened, close, component, }: { opened: boolean; close: () => void; component: | { id: string; name: string; icon: string; path: string; }[] | any[]; }) { const router = useRouter(); const [isLoading, setIsLoading] = useState(false); const [pageId, setPageId] = useState(""); return ( <> close()} position={"bottom"} size={"auto"} withCloseButton={false} styles={{ content: { padding: 0, position: "absolute", margin: "auto", backgroundColor: "transparent", left: 0, right: 0, width: 500, }, body: { backgroundColor: AccentColor.darkblue, borderTop: `2px solid ${AccentColor.blue}`, borderRight: `1px solid ${AccentColor.blue}`, borderLeft: `1px solid ${AccentColor.blue}`, borderRadius: "20px 20px 0px 0px", color: "white", paddingBottom: "5%", }, }} > {component.map((e, i) => ( { setPageId(e?.id); setIsLoading(true); router.push(e?.path, {scroll: false}); }} > {isLoading && e?.id === pageId ? ( ) : ( e?.icon )} {e?.name} ))} ); }