From b740330f1b670d47ab33ff81e438f4dcb6dd18fa Mon Sep 17 00:00:00 2001 From: LiebeAnnette Date: Thu, 5 Jun 2025 21:08:34 -0500 Subject: [PATCH] adjusted navbar responsiveness --- README.md | 6 +- client/src/components/AuthForm.tsx | 162 ++++++++++++++--------------- client/src/components/Navbar.tsx | 57 +++++----- client/styles/navbar.css | 131 ++++++++++------------- 4 files changed, 165 insertions(+), 191 deletions(-) diff --git a/README.md b/README.md index bef9ac4..4fc810f 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,7 @@ Register and log in with a username and password. Authenticated users have priva +![Expense Report Printer Page](./images/)--> --- diff --git a/client/src/components/AuthForm.tsx b/client/src/components/AuthForm.tsx index 0184c12..feeec0f 100644 --- a/client/src/components/AuthForm.tsx +++ b/client/src/components/AuthForm.tsx @@ -76,8 +76,10 @@ const AuthForm: React.FC = () => { {/* Form */} -
+ { placeholder="Username" onChange={(e) => setUsername(e.target.value)} /> -
- setPassword(e.target.value)} - /> - {/* setPassword(e.target.value)} - /> */} - -
- +
+ setPassword(e.target.value)} + /> + +
+
- {/* Toggle Login/Register */} - + {/* Toggle Login/Register */} + + + - - ); }; diff --git a/client/src/components/Navbar.tsx b/client/src/components/Navbar.tsx index 3ed893e..c4b3ede 100644 --- a/client/src/components/Navbar.tsx +++ b/client/src/components/Navbar.tsx @@ -10,39 +10,40 @@ const Navbar: React.FC = () => { setToken(null); }; -const username = localStorage.getItem("username") || "Anonymous"; + const username = localStorage.getItem("username") || "Anonymous"; return ( + )} + + + ); // return ( diff --git a/client/styles/navbar.css b/client/styles/navbar.css index fa3f28a..5f35329 100644 --- a/client/styles/navbar.css +++ b/client/styles/navbar.css @@ -1,30 +1,61 @@ +/* Base navbar styling */ nav { - background-color: var(--prussian); background-color: var(--prussian); color: white; font-family: var(--font-heading); padding: 1rem 2rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); - position: relative; } -nav h2 { - font-size: 2rem; +/* Main container: centered and narrow */ +.navbar-container { + display: flex; + flex-direction: column; + align-items: center; + max-width: 600px; + margin: 0 auto; + gap: 1rem; + text-align: center; +} + +/* Username greeting */ +.nav-user { + font-size: 1rem; font-weight: 800; text-transform: uppercase; - margin-bottom: 1rem; + color: white; + margin: 0; } -nav button:hover { - background-color: var(--yellow); +/* Logo + title stacked */ +.logo-title { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.5rem; +} + +.logo-icon { + width: 60px; + height: auto; } -.nav-header { + +.nav-title { + font-size: 2rem; + font-weight: 800; + text-transform: uppercase; + margin: 0; +} + +/* Navigation area */ +.nav-content { display: flex; + flex-direction: column; align-items: center; - justify-content: space-evenly; gap: 1rem; - width: 100%; } + +/* Links container */ .nav-links { display: flex; justify-content: center; @@ -32,6 +63,7 @@ nav button:hover { gap: 1rem; } +/* Individual link styles */ .nav-links a { color: white; text-decoration: none; @@ -47,24 +79,10 @@ nav button:hover { color: var(--prussian); } -.nav-title, -.nav-user { - margin-bottom: 0; /* remove bottom margin so they stay in line */ - width: auto; /* remove the fixed width that may cause wrapping */ -} - -.nav-title { - font-size: 2rem; - font-weight: 800; - text-transform: uppercase; - text-align: center; -} - -.nav-user { - font-size: 1rem; - font-weight: 800; - text-transform: uppercase; - text-align: center; +/* Logout button container */ +.logout-container { + display: flex; + justify-content: center; } nav button { @@ -83,58 +101,23 @@ nav button:hover { background-color: var(--yellow); } -.logout-container { - display: flex; - justify-content: center; - margin-top: 1rem; -} - -@media (min-width: 768px) { - .logout-container { - justify-content: flex-end; - margin-top: 0; - } -} - -.logo-title { - display: flex; - align-items: center; - gap: 0.5rem; - margin-bottom: 1rem; -} - -.logo-icon { - width: 60px; /* make it smaller for mobile */ - height: auto; - position: static; /* remove absolute */ - transform: none; -} - -.navbar-container { - display: flex; - flex-direction: column; - gap: 1rem; -} - +/* Responsive tweaks for wider screens */ @media (min-width: 768px) { .navbar-container { - flex-direction: row; - justify-content: space-between; - align-items: center; - flex-wrap: wrap; + flex-direction: column; /* still stack sections */ + max-width: 100%; + padding: 0 2rem; } -} -.nav-content { - display: flex; - flex-direction: column; - gap: 1rem; -} -@media (min-width: 768px) { .nav-content { flex-direction: row; - justify-content: space-between; - align-items: center; flex-wrap: wrap; + justify-content: center; + gap: 2rem; + } + + .logout-container { + justify-content: center; + margin: 0; } }