From 722f61364eac3d5a9790167464680354321dc98a Mon Sep 17 00:00:00 2001 From: Andy Chan Date: Tue, 22 Oct 2024 00:17:34 -0400 Subject: [PATCH] Move sidebar open button into Sidebar.tsx, apply to other pages Significantly reduces boilerplate of sidebar on pages where it is used. --- compass/app/admin/layout.tsx | 36 ++----- compass/app/home/layout.tsx | 36 ++----- compass/app/resource/layout.tsx | 37 ++----- compass/app/service/layout.tsx | 36 ++----- compass/components/Sidebar/Sidebar.tsx | 134 ++++++++++++++----------- 5 files changed, 106 insertions(+), 173 deletions(-) diff --git a/compass/app/admin/layout.tsx b/compass/app/admin/layout.tsx index 78bf6a6..21994d4 100644 --- a/compass/app/admin/layout.tsx +++ b/compass/app/admin/layout.tsx @@ -2,7 +2,6 @@ import Sidebar from "@/components/Sidebar/Sidebar"; import React, { useState } from "react"; -import { ChevronDoubleRightIcon } from "@heroicons/react/24/outline"; import { createClient } from "@/utils/supabase/client"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; @@ -56,34 +55,13 @@ export default function RootLayout({
{user ? (
- {/* button to open sidebar */} - - {/* sidebar */} -
- -
- {/* page ui */} +
{user ? (
- {/* button to open sidebar */} - - {/* sidebar */} -
- -
- {/* page ui */} +
{user ? (
- {/* button to open sidebar */} - - {/* sidebar */} - {/*
*/} - - { /*
*/ } + + {/*
*/} {/* page ui */}
{user ? (
- {/* button to open sidebar */} - - {/* sidebar */} -
- -
- {/* page ui */} +
= ({ isAdmin: admin, }) => { return ( -
- {/* button to close sidebar */} -
- -
-
- {/* user + logout button */} -
- + <> + {/* Button to open the sidebar. */} + + {/* The sidebar itself. */} +
+ {/* Button to close sidebar */} +
+
- {/* navigation menu */} -
-

- Pages -

- +
-
+ ); };