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 {
- +

+ {{ customerId || 'Assigned automatically when created' }} +

This ID is assigned by the system and cannot be changed. diff --git a/frontend/src/app/features/customers/customer-lookup-page.component.html b/frontend/src/app/features/customers/customer-lookup-page.component.html index 2400505..dd1491a 100644 --- a/frontend/src/app/features/customers/customer-lookup-page.component.html +++ b/frontend/src/app/features/customers/customer-lookup-page.component.html @@ -48,23 +48,23 @@

Look up a customer

No customers match this search and status.

} @else {
- +
- - - - - - + + + + + + - + @for (customer of visibleCustomers(); track customer.customerId) { - - - - - + + + + diff --git a/frontend/src/app/features/customers/customer-pages.component.css b/frontend/src/app/features/customers/customer-pages.component.css index 0240dc2..b44de7d 100644 --- a/frontend/src/app/features/customers/customer-pages.component.css +++ b/frontend/src/app/features/customers/customer-pages.component.css @@ -1,12 +1,12 @@ :host { display: block; - max-width: 1000px; + max-width: var(--content-max); margin: 2rem auto; - padding: 0 1.25rem; + padding-inline: var(--page-gutter); } .page-card { - padding: 2rem; + padding: var(--card-padding); border: 1px solid #dce3ec; border-radius: 16px; background: #fff; @@ -42,13 +42,14 @@ h1 { .choice-grid { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin-top: 2rem; } .choice-card { display: flex; + min-width: 0; min-height: 220px; flex-direction: column; padding: 1.25rem; @@ -96,11 +97,17 @@ h1 { .page-heading, .filters { display: flex; + flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; } +.page-heading > div { + flex: 1 1 16rem; + min-width: 0; +} + .page-heading { margin-bottom: 1.5rem; } @@ -128,7 +135,7 @@ h1 { } select { - min-width: 180px; + min-width: min(100%, 11.25rem); padding: 0.65rem 0.75rem; border: 1px solid #667c96; border-radius: 8px; @@ -317,28 +324,3 @@ button:disabled { background: #e6f5ed; color: #17653b; } -@media (max-width: 720px) { - .choice-grid { - grid-template-columns: 1fr; - } - - .choice-card { - min-height: auto; - } -} - -@media (max-width: 520px) { - .page-card { - padding: 1.25rem; - } - - .page-heading, - .filters { - align-items: stretch; - flex-direction: column; - } - - select { - width: 100%; - } -} diff --git a/frontend/src/app/features/interactions/interaction-list-page.component.css b/frontend/src/app/features/interactions/interaction-list-page.component.css index f7f2313..db1909d 100644 --- a/frontend/src/app/features/interactions/interaction-list-page.component.css +++ b/frontend/src/app/features/interactions/interaction-list-page.component.css @@ -1,12 +1,12 @@ :host { display: block; - max-width: 900px; + max-width: 56.25rem; margin: 2rem auto; - padding: 0 1.25rem; + padding-inline: var(--page-gutter); } .interactions { - padding: 2rem; + padding: var(--card-padding); border: 1px solid #dce3ec; border-radius: 16px; background: #fff; @@ -17,9 +17,17 @@ .activity-heading, .entry-controls { display: flex; + flex-wrap: wrap; align-items: center; justify-content: space-between; - gap: 1rem; + gap: 0.75rem 1rem; +} + +.page-heading > div, +.customer { + flex: 1 1 18rem; + min-width: 0; + max-width: 100%; } .page-heading { @@ -52,6 +60,7 @@ h1 { time { color: #536987; font-size: 0.875rem; + overflow-wrap: anywhere; } code { @@ -85,6 +94,7 @@ code { input { width: 100%; min-width: 0; + flex: 1 1 14rem; padding: 0.75rem 0.85rem; border: 1px solid var(--control-border, #667c96); border-radius: 8px; @@ -130,6 +140,7 @@ button:hover { grid-template-columns: 6rem minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; + min-width: 0; padding: 0.9rem 1rem; border: 1px solid #e5eaf0; border-radius: 10px; @@ -170,7 +181,7 @@ button:hover { .interaction-facts { display: grid; - grid-template-columns: minmax(120px, 0.35fr) 1fr; + grid-template-columns: minmax(7.5rem, 0.35fr) minmax(0, 1fr); gap: 0.7rem 1rem; margin: 1.5rem 0; } @@ -209,7 +220,9 @@ button:hover { } .summary { + min-width: 0; color: #253b57; + overflow-wrap: anywhere; } .empty-state { @@ -230,7 +243,9 @@ button:hover { .page-actions { display: flex; + flex-wrap: wrap; justify-content: flex-end; + gap: 0.75rem; margin-top: 1.5rem; } @@ -249,20 +264,26 @@ button:hover { background: #f3f6fa; } -@media (max-width: 600px) { - .interactions { - padding: 1.25rem; +@media (max-width: 48rem) { + .activity-list li { + grid-template-columns: 1fr; + gap: 0.35rem; } +} +@media (max-width: 40rem) { .page-heading, .entry-controls { align-items: stretch; flex-direction: column; } - .activity-list li { - grid-template-columns: 1fr; - gap: 0.35rem; + .page-heading > div, + .customer, + .entry-controls input, + .entry-controls button { + flex: 0 1 auto; + width: 100%; } } diff --git a/frontend/src/app/features/login/login-page.component.css b/frontend/src/app/features/login/login-page.component.css index e2fffc9..b14c1bd 100644 --- a/frontend/src/app/features/login/login-page.component.css +++ b/frontend/src/app/features/login/login-page.component.css @@ -1,8 +1,8 @@ :host { display: block; - max-width: 440px; + max-width: 27.5rem; margin: 5rem auto; - padding: 0 1.25rem; + padding-inline: var(--page-gutter); } /* .login-card { @@ -95,18 +95,19 @@ button:disabled { } .password-field input { - padding-right: 4.5rem; + min-height: 3rem; + padding-right: 5.25rem; } .password-field .password-toggle { position: absolute; top: 50%; - right: 0.4rem; + right: 0.35rem; width: auto; - min-block-size: 1.5rem; - min-inline-size: 1.5rem; + min-width: var(--tap-min); + min-height: var(--tap-min); margin: 0; - padding: 0.35rem 0.65rem; + padding: 0.35rem 0.75rem; transform: translateY(-50%); border-radius: 6px; background: transparent; @@ -129,3 +130,13 @@ button:disabled { background: #fff0ef; color: #a32922; } + +@media (max-width: 40rem) { + :host { + margin-block: 1.25rem; + } + + .login-card { + padding: var(--card-padding); + } +} diff --git a/frontend/src/styles.css b/frontend/src/styles.css index 4d2a359..9b78400 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -1,7 +1,28 @@ +/* + Shared layout tokens. Media queries cannot read custom properties, so the + same widths are repeated in component styles: + --bp-narrow 40rem (640px) phone and 200% zoom on a laptop + --bp-tablet 48rem (768px) tablet portrait + --bp-laptop 64rem (1024px) tablet landscape / small laptop +*/ :root { /* Dark enough that an empty field's border still reads against white (WCAG 1.4.11). */ --control-border: #667c96; --focus: #142b49; + --page-gutter: 1.25rem; + --card-padding: 2rem; + --tap-min: 2.75rem; + --bp-narrow: 40rem; + --bp-tablet: 48rem; + --bp-laptop: 64rem; + --content-max: 62.5rem; +} + +@media (max-width: 40rem) { + :root { + --page-gutter: 0.75rem; + --card-padding: 1.25rem; + } } body { @@ -50,16 +71,37 @@ h1:focus:not(:focus-visible) { box-sizing: border-box; } -.customer-search { - align-items: end; +button, +input, +select, +textarea { + min-height: var(--tap-min); + max-width: 100%; +} + +code, +dd { + overflow-wrap: anywhere; +} + +.readonly-value { + margin: 0; + padding: 0.75rem 0.85rem; + border: 1px solid #cbd5e1; + border-radius: 8px; + background: #f3f6fa; + color: #536987; + overflow-wrap: anywhere; } -.customer-search label { - align-self: center; +.customer-search { + align-items: end; } .customer-search input { - min-width: 220px; + flex: 1 1 12rem; + width: auto; + min-width: 0; padding: 0.65rem 0.75rem; border: 1px solid var(--control-border); border-radius: 8px; @@ -69,12 +111,14 @@ h1:focus:not(:focus-visible) { .customer-actions { display: flex; - gap: 1rem; + flex-wrap: nowrap; + align-items: center; + gap: 0.75rem; } .profile-facts { display: grid; - grid-template-columns: minmax(130px, 0.35fr) 1fr; + grid-template-columns: minmax(7.5rem, 0.35fr) minmax(0, 1fr); gap: 0.8rem 1rem; margin: 1.5rem 0; } @@ -93,3 +137,118 @@ h1:focus:not(:focus-visible) { flex-wrap: wrap; gap: 0.75rem; } + +@media (max-width: 64rem) { + a.table-action, + .profile-actions a, + .row-actions a { + display: inline-flex; + align-items: center; + min-height: var(--tap-min); + } +} + +body > canvas { + max-width: 100%; + pointer-events: none; +} + +@media (max-width: 48rem) { + .customer-search label { + flex: 1 0 100%; + } +} + +@media (max-width: 40rem) { + .page-card .choice-grid .choice-card { + min-height: auto; + } + + .page-card > .page-heading, + .page-card > .filters, + .page-card > form.filters { + align-items: stretch; + flex-direction: column; + } + + .page-heading > div, + .customer-search input, + .customer-search button { + flex: 0 1 auto; + width: 100%; + } + + .page-card .filters label, + .page-card select { + width: 100%; + max-width: none; + } + + .page-card .table-wrap { + overflow: visible; + } + + .page-card table, + .page-card tbody, + .page-card tr, + .page-card td { + display: block; + } + + .page-card thead, + .page-card thead tr, + .page-card thead th { + display: block; + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; + border: 0; + } + + .page-card tr { + margin-bottom: 0.75rem; + padding-block: 0.35rem; + border: 1px solid #e5eaf0; + border-radius: 10px; + } + + .page-card td { + display: grid; + grid-template-columns: minmax(7.5rem, 38%) minmax(0, 1fr); + gap: 0.5rem 0.75rem; + align-items: center; + justify-items: start; + border: 0; + padding: 0.45rem 0.85rem; + overflow-wrap: break-word; + } + + .page-card td .status { + width: fit-content; + max-width: 100%; + } + + .page-card td::before { + content: attr(data-label); + color: #536987; + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.04em; + text-transform: uppercase; + } + + .page-card td.customer-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + } + + .page-card td.customer-actions::before { + margin-inline-end: auto; + } +}
Customers
Customer IDCustomer nameStatusActions
Customer IDCustomer nameStatusActions
{{ customer.customerId }}{{ customer.fullName }}{{ customer.status }} +
{{ customer.customerId }}{{ customer.fullName }}{{ customer.status }} Profile for {{ customer.fullName }} Edit {{ customer.fullName }}