From 97ed1c4b855765c7c2ea85cd905760e2a6cbb368 Mon Sep 17 00:00:00 2001 From: Nathnael Date: Wed, 10 Jun 2026 09:03:33 +0000 Subject: [PATCH] fix the layout style --- .../portal/src/components/AppLayout.tsx | 193 ++++++------------ 1 file changed, 67 insertions(+), 126 deletions(-) diff --git a/apps/edr-freight-web/portal/src/components/AppLayout.tsx b/apps/edr-freight-web/portal/src/components/AppLayout.tsx index 280faa331..7931dd2e3 100644 --- a/apps/edr-freight-web/portal/src/components/AppLayout.tsx +++ b/apps/edr-freight-web/portal/src/components/AppLayout.tsx @@ -22,7 +22,7 @@ import { Sun, User, } from "lucide-react"; -import { type CSSProperties, Fragment, type ReactNode, useState } from "react"; +import { Fragment, type ReactNode, useState } from "react"; export interface SidebarItem { label: string; @@ -47,18 +47,6 @@ export interface AppLayoutProps { type Theme = "light" | "dark"; const THEME_KEY = "edr-theme"; -const EDR = { - primary: "#0EA371", - primaryDark: "#0A6F4D", - soft: "#ECF6F1", - border: "#E6ECF2", - bg: "#F4F7FA", - text: "#10202F", - muted: "#6B7C8E", - ink: "#0C1A2B", - accent: "#F2A516", -}; - function getStoredTheme(): Theme { if (typeof window === "undefined") return "light"; const stored = localStorage.getItem(THEME_KEY); @@ -94,18 +82,24 @@ function getActivePage(items: SidebarItem[], activePath: string): { label: strin const navClassNames = (active: boolean) => { if (active) { return { - root: `rounded-[10px] font-medium transition-all duration-150 bg-[#ECF6F1]! ring-1 ring-inset ring-[#0EA371]/15`, - label: `text-[#0A6F4D]! font-bold!`, - section: `text-[#0A6F4D]!`, + root: "rounded-[10px] font-medium transition-all duration-150 bg-[var(--mantine-color-edr-soft-0)]! ring-1 ring-inset ring-[var(--mantine-color-edr-green-5)]/15", + label: "text-[var(--mantine-color-edr-green-7)]! font-bold!", + section: "text-[var(--mantine-color-edr-green-7)]!", }; } return { - root: `rounded-[10px] font-medium transition-all duration-150 hover:bg-[#F1F4F7]!`, - label: `text-[#3D4D5C]! font-semibold! hover:text-[#0C1A2B]!`, - section: `text-[#54657A]! hover:text-[#0C1A2B]!`, + root: "rounded-[10px] font-medium transition-all duration-150 hover:bg-[var(--mantine-color-edr-slate-soft-0)]!", + label: "text-[var(--mantine-color-edr-slate-0)]! font-semibold! hover:text-[var(--mantine-color-edr-ink-0)]!", + section: "text-[var(--mantine-color-edr-muted-0)]! hover:text-[var(--mantine-color-edr-ink-0)]!", }; }; +// 36×36 header control chips +const islandCls = + "size-9 rounded-full border border-[var(--mantine-color-edr-border-0)] bg-white flex items-center justify-center shrink-0 cursor-pointer"; +const squareIslandCls = + "size-9 rounded-[10px] border border-[var(--mantine-color-edr-border-0)] bg-white flex items-center justify-center shrink-0 cursor-pointer"; + export function AppLayout({ title = "EDR Freight", sidebarItems, @@ -139,21 +133,6 @@ export function AppLayout({ activePath === item.href.toLowerCase() || activePath.startsWith(item.href.toLowerCase() + "/"); - // Shared header "island" styles — every control is a consistent 36px chip. - const islandStyle: CSSProperties = { - width: 36, - height: 36, - borderRadius: 999, - border: `1px solid ${EDR.border}`, - backgroundColor: "#fff", - display: "flex", - alignItems: "center", - justifyContent: "center", - flexShrink: 0, - cursor: "pointer", - }; - const toggleStyle: CSSProperties = { ...islandStyle, borderRadius: 10 }; - return ( - {/* ── Header (frosted glass; compact floating islands, mirrors the pen) ── */} + {/* ── Header ── */} - {/* Left: sidebar toggle + page title */} - - + + - + {activePage ? activePage.label : title} - {/* Right: search + bell + avatar */} {/* Search pill */} - - + + Search shipments, bookings… {/* Bell */} - - + + {enableThemeToggle && ( - + {theme === "dark" - ? - : } + ? + : } )} - {/* Avatar pill */} + {/* Avatar dropdown */} {initials} - + - - {userName} + {userName} {userEmail && {userEmail}} @@ -287,49 +255,33 @@ export function AppLayout({ {/* Brand */} - + EDR EDR FREIGHT - + Ethio–Djibouti Railway @@ -350,17 +302,13 @@ export function AppLayout({ item.section && item.section !== prevSection ? ( {item.section} @@ -421,42 +369,38 @@ export function AppLayout({ marginBottom: 10, }} > - {/* Train image fills the full card */} - - {/* Diagonal green overlay: lower-left → upper-right cut */} - - {/* Text sits on top of the green overlay */} - - + + Moving Africa Forward Reliable. Efficient. Connected. - - {/* Learn More — visible on the image area */} - Learn More - + + Learn More + + - {/* Profile */} + {/* Profile footer */} - + {initials} - + {userName} {userEmail && ( - + {userEmail} )} - + @@ -515,7 +456,7 @@ export function AppLayout({ {/* ── Main ── */}