diff --git a/docs/responsive-ui.md b/docs/responsive-ui.md new file mode 100644 index 0000000..a07add2 --- /dev/null +++ b/docs/responsive-ui.md @@ -0,0 +1,9 @@ +# Responsive layout + +The Angular UI was checked in headless Chrome, signed in as `agent`, at 360, 414, 768, 1024, 1280, 1440, and 1920 CSS pixels, plus phone landscape (740×360 and 896×414), tablet portrait and landscape, and a 640px-wide viewport standing in for 200% browser zoom on a 1280px laptop. Colors, type, copy, routes, and `data-testid` values are unchanged. + +Shared tokens live in `frontend/src/styles.css`: `--page-gutter`, `--card-padding`, `--tap-min` (2.75rem), and `--content-max` (62.5rem). Media queries repeat three widths because they cannot read variables: 40rem (640px), 48rem (768px), and 64rem (1024px). Below 40rem the page gutter and card padding shrink. Below 64rem, nav links, profile links, and table actions are at least 44px tall. Buttons and fields are at least 44px at every width. + +The header keeps “Northstar CRM” on one line and lets the nav wrap under it on a phone. Home choice cards use `repeat(auto-fit, minmax(min(100%, 17rem), 1fr))`, so a phone shows one column, a 768px tablet shows two, and a laptop shows the original three. Customer lookup keeps the table from 640px up. Below that, each row is a stacked card with the same Profile and Edit links. The create form shows the public-ID sentence in a wrapping field instead of a single-line input that was clipping it. Interaction headings and timeline rows wrap instead of overlapping around 640px, and rows stack below 768px. Login’s show/hide control is a 44px target. The viewport meta tag was already `width=device-width, initial-scale=1`. + +Still not ideal: above 1024px the nav stays the original compact text so a projector view matches the old header. At 768px the third home card sits alone on the next row, and the interaction timeline stacks each field rather than keeping one tight row. A 360px header wraps Log out onto its own line. Wide screens stay centered (1000px, 900px, and 440px) instead of stretching to 1920px. Screenshots are in `frontend/responsive-screenshots/` and are gitignored. diff --git a/frontend/.gitignore b/frontend/.gitignore index 50de3b0..ec6aa84 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -41,3 +41,6 @@ testem.log # System files .DS_Store Thumbs.db + +# Local responsive audit screenshots (before/after). Not part of the app. +/responsive-screenshots diff --git a/frontend/src/app/app.component.css b/frontend/src/app/app.component.css index e510baf..749a296 100644 --- a/frontend/src/app/app.component.css +++ b/frontend/src/app/app.component.css @@ -1,26 +1,32 @@ header { display: flex; + flex-wrap: wrap; align-items: center; justify-content: space-between; - gap: 1rem; - padding: 1rem max(1.25rem, calc((100% - 1100px) / 2)); + gap: 0.75rem 1.25rem; + padding: 0.75rem max(var(--page-gutter), calc((100% - 1100px) / 2)); border-bottom: 1px solid #dce3ec; background: #fff; } .brand { + flex: 0 0 auto; color: #142b49; font-size: 1.15rem; font-weight: 700; + white-space: nowrap; text-decoration: none; } header nav, header nav ul { display: flex; - align-items: center; + flex: 1 1 28rem; flex-wrap: wrap; - gap: 1rem; + align-items: center; + justify-content: flex-end; + gap: 0.25rem 1rem; + min-width: min(100%, 18rem); } header nav ul { @@ -60,8 +66,12 @@ header nav a { text-decoration: none; } +header nav span { + overflow-wrap: anywhere; +} + main { - padding: 0 1.25rem; + padding-inline: var(--page-gutter); } button { @@ -78,3 +88,26 @@ button { button:hover { background: #f3f6fa; } + +@media (max-width: 64rem) { + header { + align-items: flex-start; + } + + .brand, + header nav a { + display: inline-flex; + align-items: center; + min-height: var(--tap-min); + } + + header nav a { + padding-inline: 0.2rem; + } +} + +@media (max-width: 40rem) { + header nav { + justify-content: flex-start; + } +} diff --git a/frontend/src/app/features/customers/customer-form-page.component.ts b/frontend/src/app/features/customers/customer-form-page.component.ts index 1c7311c..098c2f8 100644 --- a/frontend/src/app/features/customers/customer-form-page.component.ts +++ b/frontend/src/app/features/customers/customer-form-page.component.ts @@ -30,13 +30,9 @@ import { CustomerStatus } from './customer.model'; } @else {