From 5604fba5391994e0f8e0d378fd6dd14d085eaebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Wed, 30 Sep 2026 11:16:25 +0200 Subject: [PATCH 1/5] feat(shell): add app shell and core routes Refs: #9 --- apps/web/src/App.tsx | 42 +++-- apps/web/src/components/shell/AppShell.css | 22 +++ apps/web/src/components/shell/AppShell.tsx | 19 +++ .../src/components/shell/RouteDestination.css | 17 ++ .../src/components/shell/RouteDestination.tsx | 16 ++ apps/web/src/components/shell/SiteHeader.css | 150 ++++++++++++++++++ apps/web/src/components/shell/SiteHeader.tsx | 96 +++++++++++ e2e/smoke.spec.ts | 41 ++++- 8 files changed, 379 insertions(+), 24 deletions(-) create mode 100644 apps/web/src/components/shell/AppShell.css create mode 100644 apps/web/src/components/shell/AppShell.tsx create mode 100644 apps/web/src/components/shell/RouteDestination.css create mode 100644 apps/web/src/components/shell/RouteDestination.tsx create mode 100644 apps/web/src/components/shell/SiteHeader.css create mode 100644 apps/web/src/components/shell/SiteHeader.tsx diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 32ca725..5a2ec56 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,37 +1,35 @@ -import { NavLink, Route, Routes } from 'react-router-dom'; +import { Route, Routes } from 'react-router-dom'; + +import AppShell from './components/shell/AppShell'; +import RouteDestination from './components/shell/RouteDestination'; const pages = [ ['/', 'Explore'], ['/cookbook', 'My Cookbook'], ['/recipes/new', 'Add Recipe'], ] as const; -const Page = ({ title }: { title: string }) => ( -
-

{title}

-
-); export function App() { return ( - <> -
- Recipe Platform - -
+ {pages.map(([path, title]) => ( - } /> + } + /> ))} - } /> - } /> - } /> + } + /> + } /> + } + /> - + ); } diff --git a/apps/web/src/components/shell/AppShell.css b/apps/web/src/components/shell/AppShell.css new file mode 100644 index 0000000..404f22c --- /dev/null +++ b/apps/web/src/components/shell/AppShell.css @@ -0,0 +1,22 @@ +@layer components { + .app-shell { + min-height: 100dvh; + background: + radial-gradient( + circle at 100% 0%, + color-mix(in srgb, var(--color-brand-accent-soft) 80%, transparent) 0, + transparent 28rem + ), + var(--color-bg-page); + } + + .app-shell__main { + padding-block: var(--space-12); + } + + @media (max-width: 48rem) { + .app-shell__main { + padding-block: var(--space-8); + } + } +} diff --git a/apps/web/src/components/shell/AppShell.tsx b/apps/web/src/components/shell/AppShell.tsx new file mode 100644 index 0000000..1b835a3 --- /dev/null +++ b/apps/web/src/components/shell/AppShell.tsx @@ -0,0 +1,19 @@ +import type { ReactNode } from 'react'; + +import SiteHeader from './SiteHeader'; +import './AppShell.css'; + +type AppShellProps = { + children: ReactNode; +}; + +function AppShell({ children }: AppShellProps) { + return ( +
+ +
{children}
+
+ ); +} + +export default AppShell; diff --git a/apps/web/src/components/shell/RouteDestination.css b/apps/web/src/components/shell/RouteDestination.css new file mode 100644 index 0000000..2024862 --- /dev/null +++ b/apps/web/src/components/shell/RouteDestination.css @@ -0,0 +1,17 @@ +@layer components { + .route-page { + display: grid; + align-content: center; + min-height: min(32rem, calc(100dvh - 10rem)); + padding-block: var(--space-8); + } + + .route-page__eyebrow { + margin-bottom: var(--space-3); + color: var(--color-text-accent); + font-size: var(--font-size-sm); + font-weight: var(--font-weight-bold); + letter-spacing: var(--letter-spacing-wide); + text-transform: uppercase; + } +} diff --git a/apps/web/src/components/shell/RouteDestination.tsx b/apps/web/src/components/shell/RouteDestination.tsx new file mode 100644 index 0000000..55c8df1 --- /dev/null +++ b/apps/web/src/components/shell/RouteDestination.tsx @@ -0,0 +1,16 @@ +import './RouteDestination.css'; + +type RouteDestinationProps = { + title: string; +}; + +function RouteDestination({ title }: RouteDestinationProps) { + return ( +
+

Recipe Platform

+

{title}

+
+ ); +} + +export default RouteDestination; diff --git a/apps/web/src/components/shell/SiteHeader.css b/apps/web/src/components/shell/SiteHeader.css new file mode 100644 index 0000000..f6f944a --- /dev/null +++ b/apps/web/src/components/shell/SiteHeader.css @@ -0,0 +1,150 @@ +@layer components { + .site-header { + position: sticky; + z-index: var(--z-sticky); + top: 0; + border-bottom: var(--border-width-thin) solid var(--color-border-divider); + background-color: color-mix(in srgb, var(--color-surface) 94%, transparent); + backdrop-filter: blur(0.75rem); + } + + .site-header__inner { + display: flex; + align-items: center; + gap: var(--space-8); + min-height: 5rem; + } + + .brand { + display: inline-flex; + flex: 0 0 auto; + align-items: center; + gap: var(--space-3); + color: var(--color-text-primary); + font-size: var(--font-size-lg); + font-weight: var(--font-weight-bold); + text-decoration: none; + } + + .brand:hover { + color: var(--color-text-primary); + } + + .brand__mark { + display: grid; + flex: 0 0 auto; + place-items: center; + width: 2.25rem; + height: 2.25rem; + border-radius: var(--radius-md); + color: var(--color-text-inverse); + background-color: var(--color-brand-primary); + font-family: Georgia, serif; + font-size: var(--font-size-xl); + } + + .site-header__controls { + display: flex; + flex: 1 1 auto; + align-items: center; + justify-content: space-between; + gap: var(--space-6); + min-width: 0; + } + + .primary-navigation, + .account-navigation { + display: flex; + align-items: center; + gap: var(--space-2); + } + + .primary-navigation__link, + .account-navigation__link { + display: inline-flex; + align-items: center; + min-height: var(--target-size-min); + gap: var(--space-2); + padding: var(--space-2) var(--space-3); + border-radius: var(--radius-md); + color: var(--color-text-secondary); + font-size: var(--font-size-sm); + font-weight: var(--font-weight-semibold); + text-decoration: none; + white-space: nowrap; + } + + .primary-navigation__link:hover, + .account-navigation__link:hover { + color: var(--color-text-primary); + background-color: var(--color-surface-hover); + } + + .primary-navigation__link--active { + color: var(--color-brand-primary-active); + background-color: var(--color-brand-accent-soft); + } + + .account-navigation__register { + min-height: var(--target-size-min); + } + + .navigation-link__icon { + flex-shrink: 0; + width: var(--icon-size-md); + height: var(--icon-size-md); + } + + .menu-toggle { + display: none; + margin-left: auto; + } + + @media (max-width: 48rem) { + .site-header__inner { + flex-wrap: wrap; + gap: 0; + min-height: 4.5rem; + padding-block: var(--space-3); + } + + .menu-toggle { + display: inline-flex; + } + + .site-header__controls { + display: none; + flex-basis: 100%; + align-items: stretch; + padding-block: var(--space-3) var(--space-2); + border-top: var(--border-width-thin) solid var(--color-border-subtle); + } + + .site-header__controls--open { + display: flex; + flex-direction: column; + } + + .primary-navigation, + .account-navigation { + align-items: stretch; + flex-direction: column; + gap: var(--space-1); + } + + .primary-navigation__link, + .account-navigation__link, + .account-navigation__register { + width: 100%; + } + + .primary-navigation__link, + .account-navigation__link { + justify-content: flex-start; + } + + .account-navigation__register { + justify-content: center; + } + } +} diff --git a/apps/web/src/components/shell/SiteHeader.tsx b/apps/web/src/components/shell/SiteHeader.tsx new file mode 100644 index 0000000..67a21a8 --- /dev/null +++ b/apps/web/src/components/shell/SiteHeader.tsx @@ -0,0 +1,96 @@ +import { useState } from 'react'; +import { NavLink, useNavigate } from 'react-router-dom'; + +import Button from '../ui/Button/Button'; +import IconButton from '../ui/IconButton/IconButton'; +import { AddRecipeIcon, CloseIcon } from '../../icons/actions'; +import { + CookbookIcon, + HomeIcon, + MenuIcon, + ProfileIcon, +} from '../../icons/navigation'; +import './SiteHeader.css'; + +const pages = [ + ['/', 'Explore', HomeIcon], + ['/cookbook', 'My Cookbook', CookbookIcon], + ['/recipes/new', 'Add Recipe', AddRecipeIcon], +] as const; + +function SiteHeader() { + const [menuOpen, setMenuOpen] = useState(false); + const navigate = useNavigate(); + + const closeMenu = () => setMenuOpen(false); + + return ( +
+
+ + + Recipe Platform + + + setMenuOpen((isOpen) => !isOpen)} + /> + +
+ + +
+
+
+ ); +} + +export default SiteHeader; diff --git a/e2e/smoke.spec.ts b/e2e/smoke.spec.ts index 4a0efc4..22dec08 100644 --- a/e2e/smoke.spec.ts +++ b/e2e/smoke.spec.ts @@ -1,6 +1,43 @@ import { expect, test } from '@playwright/test'; -test('opens the catalog shell', async ({ page }) => { +const coreRoutes = [ + ['/', 'Explore'], + ['/cookbook', 'My Cookbook'], + ['/recipes/new', 'Add Recipe'], + ['/recipes/42', 'Recipe Detail'], + ['/login', 'Login'], + ['/register', 'Register'], +] as const; + +test('renders each core route through the shared shell', async ({ page }) => { + for (const [path, title] of coreRoutes) { + await page.goto(path === '/' ? '.' : path.slice(1)); + await expect(page.getByRole('heading', { name: title })).toBeVisible(); + await expect(page.getByRole('banner')).toBeVisible(); + } +}); + +test('keeps the mobile shell within the viewport and keyboard reachable', async ({ + page, +}) => { + await page.setViewportSize({ width: 390, height: 844 }); await page.goto('.'); - await expect(page.getByRole('heading', { name: 'Explore' })).toBeVisible(); + + expect( + await page.evaluate(() => document.documentElement.scrollWidth), + ).toBeLessThanOrEqual( + await page.evaluate(() => document.documentElement.clientWidth), + ); + + const menuButton = page.getByRole('button', { + name: 'Open navigation menu', + }); + await menuButton.focus(); + await page.keyboard.press('Enter'); + await expect( + page.getByRole('button', { name: 'Close navigation menu' }), + ).toHaveAttribute('aria-expanded', 'true'); + await expect( + page.getByRole('navigation', { name: 'Primary navigation' }), + ).toBeVisible(); }); From 1e546693791f6f4cac3bf6984ed39a4eed4dbc49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Wed, 30 Sep 2026 19:56:12 +0200 Subject: [PATCH 2/5] feat(shell): refine app shell structure and navigation Refs: #9 --- apps/web/src/App.tsx | 12 +++--- .../RouteDestination.css | 0 .../RouteDestination.tsx | 0 apps/web/src/components/shell/AppShell.tsx | 19 ---------- .../shell/{ => AppShell}/AppShell.css | 10 ----- .../components/shell/AppShell/AppShell.tsx | 17 +++++++++ .../shell/{ => SiteHeader}/SiteHeader.css | 37 ++++++++++++++++--- .../shell/{ => SiteHeader}/SiteHeader.tsx | 31 ++++++++-------- 8 files changed, 70 insertions(+), 56 deletions(-) rename apps/web/src/components/{shell => RouteDestination}/RouteDestination.css (100%) rename apps/web/src/components/{shell => RouteDestination}/RouteDestination.tsx (100%) delete mode 100644 apps/web/src/components/shell/AppShell.tsx rename apps/web/src/components/shell/{ => AppShell}/AppShell.css (62%) create mode 100644 apps/web/src/components/shell/AppShell/AppShell.tsx rename apps/web/src/components/shell/{ => SiteHeader}/SiteHeader.css (72%) rename apps/web/src/components/shell/{ => SiteHeader}/SiteHeader.tsx (77%) diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 5a2ec56..8b7e79b 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,7 +1,7 @@ import { Route, Routes } from 'react-router-dom'; -import AppShell from './components/shell/AppShell'; -import RouteDestination from './components/shell/RouteDestination'; +import AppShell from './components/shell/AppShell/AppShell'; +import RouteDestination from './components/RouteDestination/RouteDestination'; const pages = [ ['/', 'Explore'], @@ -11,8 +11,8 @@ const pages = [ export function App() { return ( - - + + }> {pages.map(([path, title]) => ( } /> - - + + ); } diff --git a/apps/web/src/components/shell/RouteDestination.css b/apps/web/src/components/RouteDestination/RouteDestination.css similarity index 100% rename from apps/web/src/components/shell/RouteDestination.css rename to apps/web/src/components/RouteDestination/RouteDestination.css diff --git a/apps/web/src/components/shell/RouteDestination.tsx b/apps/web/src/components/RouteDestination/RouteDestination.tsx similarity index 100% rename from apps/web/src/components/shell/RouteDestination.tsx rename to apps/web/src/components/RouteDestination/RouteDestination.tsx diff --git a/apps/web/src/components/shell/AppShell.tsx b/apps/web/src/components/shell/AppShell.tsx deleted file mode 100644 index 1b835a3..0000000 --- a/apps/web/src/components/shell/AppShell.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import type { ReactNode } from 'react'; - -import SiteHeader from './SiteHeader'; -import './AppShell.css'; - -type AppShellProps = { - children: ReactNode; -}; - -function AppShell({ children }: AppShellProps) { - return ( -
- -
{children}
-
- ); -} - -export default AppShell; diff --git a/apps/web/src/components/shell/AppShell.css b/apps/web/src/components/shell/AppShell/AppShell.css similarity index 62% rename from apps/web/src/components/shell/AppShell.css rename to apps/web/src/components/shell/AppShell/AppShell.css index 404f22c..e945a95 100644 --- a/apps/web/src/components/shell/AppShell.css +++ b/apps/web/src/components/shell/AppShell/AppShell.css @@ -9,14 +9,4 @@ ), var(--color-bg-page); } - - .app-shell__main { - padding-block: var(--space-12); - } - - @media (max-width: 48rem) { - .app-shell__main { - padding-block: var(--space-8); - } - } } diff --git a/apps/web/src/components/shell/AppShell/AppShell.tsx b/apps/web/src/components/shell/AppShell/AppShell.tsx new file mode 100644 index 0000000..195600a --- /dev/null +++ b/apps/web/src/components/shell/AppShell/AppShell.tsx @@ -0,0 +1,17 @@ +import { Outlet } from 'react-router-dom'; + +import SiteHeader from '../SiteHeader/SiteHeader'; +import './AppShell.css'; + +function AppShell() { + return ( +
+ +
+ +
+
+ ); +} + +export default AppShell; diff --git a/apps/web/src/components/shell/SiteHeader.css b/apps/web/src/components/shell/SiteHeader/SiteHeader.css similarity index 72% rename from apps/web/src/components/shell/SiteHeader.css rename to apps/web/src/components/shell/SiteHeader/SiteHeader.css index f6f944a..a3c6713 100644 --- a/apps/web/src/components/shell/SiteHeader.css +++ b/apps/web/src/components/shell/SiteHeader/SiteHeader.css @@ -60,18 +60,24 @@ } .primary-navigation__link, - .account-navigation__link { + .account-navigation__link, + .account-navigation__register { display: inline-flex; align-items: center; min-height: var(--target-size-min); gap: var(--space-2); padding: var(--space-2) var(--space-3); + border: var(--border-width-thin) solid transparent; border-radius: var(--radius-md); color: var(--color-text-secondary); font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); text-decoration: none; white-space: nowrap; + transition: + color var(--duration-fast) var(--ease-standard), + background-color var(--duration-fast) var(--ease-standard), + border-color var(--duration-fast) var(--ease-standard); } .primary-navigation__link:hover, @@ -80,13 +86,34 @@ background-color: var(--color-surface-hover); } - .primary-navigation__link--active { + .primary-navigation__link--active, + .account-navigation__link--active { + color: var(--color-brand-primary-active); + background-color: var(--color-surface-selected); + border-color: var(--color-brand-primary); + } + + .primary-navigation__link--active:hover, + .account-navigation__link--active:hover { color: var(--color-brand-primary-active); - background-color: var(--color-brand-accent-soft); + background-color: var(--color-surface-pressed); } .account-navigation__register { - min-height: var(--target-size-min); + color: var(--color-text-inverse); + background-color: var(--color-brand-primary); + } + + .account-navigation__register:hover { + color: var(--color-text-inverse); + background-color: var(--color-brand-primary-hover); + } + + .account-navigation__register--active, + .account-navigation__register--active:hover { + color: var(--color-text-inverse); + background-color: var(--color-brand-primary-active); + border-color: var(--color-brand-primary-active); } .navigation-link__icon { @@ -104,7 +131,7 @@ .site-header__inner { flex-wrap: wrap; gap: 0; - min-height: 4.5rem; + min-height: 5rem; padding-block: var(--space-3); } diff --git a/apps/web/src/components/shell/SiteHeader.tsx b/apps/web/src/components/shell/SiteHeader/SiteHeader.tsx similarity index 77% rename from apps/web/src/components/shell/SiteHeader.tsx rename to apps/web/src/components/shell/SiteHeader/SiteHeader.tsx index 67a21a8..4ad8d4b 100644 --- a/apps/web/src/components/shell/SiteHeader.tsx +++ b/apps/web/src/components/shell/SiteHeader/SiteHeader.tsx @@ -1,15 +1,14 @@ import { useState } from 'react'; -import { NavLink, useNavigate } from 'react-router-dom'; +import { NavLink } from 'react-router-dom'; -import Button from '../ui/Button/Button'; -import IconButton from '../ui/IconButton/IconButton'; -import { AddRecipeIcon, CloseIcon } from '../../icons/actions'; +import { AddRecipeIcon, CloseIcon } from '../../../icons/actions'; import { CookbookIcon, HomeIcon, MenuIcon, ProfileIcon, -} from '../../icons/navigation'; +} from '../../../icons/navigation'; +import IconButton from '../../ui/IconButton/IconButton'; import './SiteHeader.css'; const pages = [ @@ -20,7 +19,6 @@ const pages = [ function SiteHeader() { const [menuOpen, setMenuOpen] = useState(false); - const navigate = useNavigate(); const closeMenu = () => setMenuOpen(false); @@ -38,7 +36,7 @@ function SiteHeader() { className="menu-toggle" icon={menuOpen ? CloseIcon : MenuIcon} iconSize="lg" - variant="secondary" + variant="primary" aria-label={ menuOpen ? 'Close navigation menu' : 'Open navigation menu' } @@ -69,23 +67,24 @@ function SiteHeader() { From 89abfa5a31493d66e438e2bf141e7dfbb7234153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Wed, 30 Sep 2026 20:17:15 +0200 Subject: [PATCH 3/5] fix(shell): tune responsiveness of site-header Refs: #9 --- .../components/shell/SiteHeader/SiteHeader.css | 3 ++- e2e/smoke.spec.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/shell/SiteHeader/SiteHeader.css b/apps/web/src/components/shell/SiteHeader/SiteHeader.css index a3c6713..24cc0f1 100644 --- a/apps/web/src/components/shell/SiteHeader/SiteHeader.css +++ b/apps/web/src/components/shell/SiteHeader/SiteHeader.css @@ -127,7 +127,8 @@ margin-left: auto; } - @media (max-width: 48rem) { + @media (max-width: 55rem) { + /* Adjust to tune when the burger menu appears */ .site-header__inner { flex-wrap: wrap; gap: 0; diff --git a/e2e/smoke.spec.ts b/e2e/smoke.spec.ts index 22dec08..a35de19 100644 --- a/e2e/smoke.spec.ts +++ b/e2e/smoke.spec.ts @@ -41,3 +41,19 @@ test('keeps the mobile shell within the viewport and keyboard reachable', async page.getByRole('navigation', { name: 'Primary navigation' }), ).toBeVisible(); }); + +test('collapses the header before navigation actions overflow', async ({ + page, +}) => { + await page.setViewportSize({ width: 800, height: 844 }); + await page.goto('.'); + + await expect( + page.getByRole('button', { name: 'Open navigation menu' }), + ).toBeVisible(); + expect( + await page.evaluate(() => document.documentElement.scrollWidth), + ).toBeLessThanOrEqual( + await page.evaluate(() => document.documentElement.clientWidth), + ); +}); From 423b58c5c4c008a251f72e629e1dd571fd602cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Thu, 1 Oct 2026 07:42:02 +0200 Subject: [PATCH 4/5] fix(web): add mobile viewport metadata Refs: #9 --- apps/web/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/web/index.html b/apps/web/index.html index 39688cc..98d93bf 100644 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -1,2 +1,12 @@ -
- + + + + + + Recipe Platform + + +
+ + + From d2ecf87c056be8aed97fdd8759576c172afdb33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Thu, 1 Oct 2026 07:49:36 +0200 Subject: [PATCH 5/5] fix(shell): reduce space between header and content Refs: #9 --- apps/web/src/components/RouteDestination/RouteDestination.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/web/src/components/RouteDestination/RouteDestination.css b/apps/web/src/components/RouteDestination/RouteDestination.css index 2024862..b20fd11 100644 --- a/apps/web/src/components/RouteDestination/RouteDestination.css +++ b/apps/web/src/components/RouteDestination/RouteDestination.css @@ -1,8 +1,5 @@ @layer components { .route-page { - display: grid; - align-content: center; - min-height: min(32rem, calc(100dvh - 10rem)); padding-block: var(--space-8); }