From 08eebfa7ac6d0d038fcfbdef867b666c6b6ce819 Mon Sep 17 00:00:00 2001 From: Wilhelm Svensgaard Rolstad Date: Sat, 14 Nov 2026 10:46:26 +0100 Subject: [PATCH 1/4] feat: added a shared layout for all pages to have shared width and padding --- frontend/src/App.tsx | 43 +++---- frontend/src/components/Layout.tsx | 27 +++++ .../src/components/pageSections/Footer.tsx | 20 ++-- .../src/components/pageSections/Header.tsx | 2 +- .../src/pages/accountPage/accountPage.tsx | 6 +- .../src/pages/categoryPage/categoryPage.tsx | 2 +- .../src/pages/communityPage/communityPage.tsx | 2 +- frontend/src/pages/homePage/homePage.tsx | 106 +++++++++--------- frontend/src/pages/loginPage/loginPage.tsx | 10 +- .../components/OpenSavedBuild.tsx | 4 +- .../src/pages/pcBuilderPage/pcBuilderPage.tsx | 94 ++++++++-------- 11 files changed, 165 insertions(+), 151 deletions(-) create mode 100644 frontend/src/components/Layout.tsx diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 4b8c57a..016b702 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,13 +3,10 @@ import HomePage from "./pages/homePage/homePage"; import CategoryPage from "./pages/categoryPage/categoryPage"; import PcBuilderPage from "./pages/pcBuilderPage/pcBuilderPage"; import CommunityPage from "./pages/communityPage/communityPage"; -import NavBar from "./components/pageSections/Header"; -import Footer from "./components/pageSections/Footer"; -import BackToTopButton from "./components/buttons/BackToTopButton"; +import Layout from "./components/Layout"; import LoginPage from "./pages/loginPage/loginPage"; import AccountPage from "./pages/accountPage/accountPage"; import { Routes, Route, useLocation, useParams } from "react-router"; -import Notification from "./components/Notification"; import { useSelector } from "react-redux"; import type { RootState } from "./state/store"; @@ -28,29 +25,21 @@ function App() { (state: RootState) => state.auth.user?.uid ?? "guest", ); return ( -
-
- -
-
- - } /> - } /> - } - /> - } /> - } /> - } /> - } /> - 404 - Page not found

} /> -
-
-
- - -
+ + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + 404 - Page not found

} + /> +
+
); } export default App; diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx new file mode 100644 index 0000000..f8d5c4b --- /dev/null +++ b/frontend/src/components/Layout.tsx @@ -0,0 +1,27 @@ +import type { ReactNode } from "react"; +import NavBar from "./pageSections/Header"; +import Footer from "./pageSections/Footer"; +import BackToTopButton from "./buttons/BackToTopButton"; +import Notification from "./Notification"; + +const contentWidth = "mx-auto w-full max-w-7xl px-4 sm:px-6"; + +export default function Layout({ children }: { children: ReactNode }) { + return ( +
+
+
+ +
+
+
{children}
+
+
+
+
+
+ + +
+ ); +} diff --git a/frontend/src/components/pageSections/Footer.tsx b/frontend/src/components/pageSections/Footer.tsx index acc6f9c..408c7c1 100644 --- a/frontend/src/components/pageSections/Footer.tsx +++ b/frontend/src/components/pageSections/Footer.tsx @@ -1,16 +1,14 @@ export default function Footer() { return ( - + +

© 2026 Team 15, IT2810

+ ); } diff --git a/frontend/src/components/pageSections/Header.tsx b/frontend/src/components/pageSections/Header.tsx index 02f633e..22aa0cb 100644 --- a/frontend/src/components/pageSections/Header.tsx +++ b/frontend/src/components/pageSections/Header.tsx @@ -32,7 +32,7 @@ export default function NavBar() { return (