From 5902664658a36e4afc81327eea9f8eef05561bcb Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Mon, 30 Dec 2024 12:15:35 +0000
Subject: refactor: Refactor sidebar into a shared component

---
 .../components/shared/sidebar/SidebarLayout.tsx    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 apps/web/components/shared/sidebar/SidebarLayout.tsx

(limited to 'apps/web/components/shared/sidebar/SidebarLayout.tsx')

diff --git a/apps/web/components/shared/sidebar/SidebarLayout.tsx b/apps/web/components/shared/sidebar/SidebarLayout.tsx
new file mode 100644
index 00000000..2a2a872e
--- /dev/null
+++ b/apps/web/components/shared/sidebar/SidebarLayout.tsx
@@ -0,0 +1,37 @@
+import Header from "@/components/dashboard/header/Header";
+import DemoModeBanner from "@/components/DemoModeBanner";
+import { Separator } from "@/components/ui/separator";
+import ValidAccountCheck from "@/components/utils/ValidAccountCheck";
+
+import serverConfig from "@hoarder/shared/config";
+
+export default function SidebarLayout({
+  children,
+  mobileSidebar,
+  sidebar,
+  modal,
+}: {
+  children: React.ReactNode;
+  mobileSidebar: React.ReactNode;
+  sidebar: React.ReactNode;
+  modal?: React.ReactNode;
+}) {
+  return (
+    <div>
+      <Header />
+      <div className="flex min-h-[calc(100vh-64px)] w-screen flex-col sm:h-[calc(100vh-64px)] sm:flex-row">
+        <ValidAccountCheck />
+        <div className="hidden flex-none sm:flex">{sidebar}</div>
+        <main className="flex-1 bg-muted sm:overflow-y-auto">
+          {serverConfig.demoMode && <DemoModeBanner />}
+          <div className="block w-full sm:hidden">
+            {mobileSidebar}
+            <Separator />
+          </div>
+          {modal}
+          <div className="min-h-30 container p-4">{children}</div>
+        </main>
+      </div>
+    </div>
+  );
+}
-- 
cgit v1.2.3-70-g09d2

