Skip to content

Commit 32701e2

Browse files
committed
Page width for Dynamic Endpoints and page-layout.md
1 parent 2a5013a commit 32701e2

5 files changed

Lines changed: 121 additions & 2 deletions

File tree

apps/api-manager/CLAUDE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212

1313
- Do not add patronising or condescending warnings, tooltips, or helper text (e.g. "Use with caution", "Are you sure?", "This action cannot be undone"). Trust that users understand what they are doing.
1414

15+
## Page layout & width
16+
17+
Follow [`docs/page-layout.md`](docs/page-layout.md) for content width on pages:
18+
19+
- Default config/dashboard page wrapper is `container mx-auto max-w-7xl px-4 py-8`.
20+
- These are API configuration pages, not prose — caps exist to limit eye-scan distance and center content, not to fit small screens.
21+
- Wide tables / code blocks should break out to full width (and use `overflow-x-auto`) rather than widening the whole page.
22+
1523
## HTML best practices
1624

1725
Follow the guidelines in [`docs/playwright-friendly-html.md`](docs/playwright-friendly-html.md) when writing or modifying Svelte components:

apps/api-manager/src/routes/(protected)/dynamic-endpoints/bank/[bank_id]/[id]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
<title>{info.title} - Bank Dynamic Endpoint - API Manager</title>
157157
</svelte:head>
158158

159-
<div class="container mx-auto max-w-5xl px-4 py-8">
159+
<div class="container mx-auto max-w-7xl px-4 py-8">
160160
<!-- Breadcrumb -->
161161
<div class="mb-6">
162162
<a

apps/api-manager/src/routes/(protected)/dynamic-endpoints/system/[id]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<title>{info.title} - System Dynamic Endpoint - API Manager</title>
156156
</svelte:head>
157157

158-
<div class="container mx-auto max-w-5xl px-4 py-8">
158+
<div class="container mx-auto max-w-7xl px-4 py-8">
159159
<!-- Breadcrumb -->
160160
<div class="mb-6">
161161
<a

apps/portal/CLAUDE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
When making client-side calls to the OBP-API, use the generic proxy at `/proxy/obp/...` instead of creating dedicated API route files. The proxy adds OAuth authentication and passes responses through unmodified. Only create dedicated `/backend/...` routes when custom logic is needed (e.g. protocol bridging like gRPC → SSE). See [docs/obp-proxy.md](docs/obp-proxy.md) for details.
66

7+
## Page Layout & Width
8+
9+
Follow [page-layout.md](../../page-layout.md) (repo root — shared with API Manager) for content width on pages:
10+
11+
- Default config/dashboard page wrapper is `container mx-auto max-w-7xl px-4 py-8`.
12+
- These are configuration pages, not prose — caps exist to limit eye-scan distance and center content, not to fit small screens.
13+
- Wide tables / code blocks should break out to full width (and use `overflow-x-auto`) rather than widening the whole page.
14+
715
## HTML Best Practices
816

917
Follow the guidelines in [docs/playwright-friendly-html.md](docs/playwright-friendly-html.md) when writing HTML. Key points:

page-layout.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Page Layout & Width Conventions
2+
3+
How wide should a page's content be? These are **configuration / dashboard pages for an
4+
API system** — not prose or marketing. The goal is dense, scannable, uncramped control
5+
surfaces, not a comfortable reading column for long-form text.
6+
7+
## Why cap the width at all
8+
9+
A `max-width` cap is **not** about fitting small screens — narrow displays are already
10+
handled by responsive padding (`px-4`), `sm:`/`md:` breakpoints, and `overflow-x-auto`.
11+
The cap only matters on screens *wider* than the cap, and it earns its place by:
12+
13+
- **Keeping eye-scan distance sane.** Form labels and rows of fields stretched across a
14+
27"/4K monitor force the eye to travel a long way to pair a label with its value.
15+
- **Centering content** (`mx-auto`) so wide screens look intentional instead of pinning
16+
everything to the left with a huge empty right gutter.
17+
- **Sizing forms sensibly** — a single text input is absurd at 2000px wide.
18+
19+
It is **not** about line length for prose (we rarely have paragraphs here).
20+
21+
## The default
22+
23+
Standard configuration page wrapper:
24+
25+
```svelte
26+
<div class="container mx-auto max-w-7xl px-4 py-8">
27+
```
28+
29+
`max-w-7xl` (1280px) is our default for pages that mix metadata cards, forms, and tables.
30+
It feels full on a laptop without sprawling on a large monitor.
31+
32+
| Use case | Width |
33+
| ---------------------------------------------------- | ---------------- |
34+
| **Default** config/dashboard page (cards + forms) | `max-w-7xl` |
35+
| Focused single-column form / wizard step | `max-w-2xl``3xl`|
36+
| Wide data: tables, code/JSON, diagrams | **break out** (see below) |
37+
38+
Avoid inventing new in-between caps (`4xl`, `5xl`, `6xl`) per page. Pick from the rows
39+
above so detail pages line up with each other.
40+
41+
## Why consistency across pages matters
42+
43+
Consistency is best practice — but it's a **means, not the goal**. The goal is to reduce
44+
friction and communicate clearly. Consistency serves that by:
45+
46+
- **Predictability.** When every detail page is the same width and aligns the same way,
47+
users build a mental model once and reuse it everywhere (Jakob's Law — people expect
48+
your app to match patterns they already know, including its own internal patterns). The
49+
page becomes muscle memory instead of something to figure out.
50+
- **Lower cognitive load.** Every arbitrary visual difference is a small question the brain
51+
has to answer — "is this page wider on purpose? does it mean something?" Random variation
52+
spends the user's attention on noise instead of the task (configuring the API).
53+
- **Maintainability.** A small set of known widths is easier to restyle and test than a
54+
dozen bespoke ones. Change the default once, not on every page.
55+
- **Perceived quality.** Consistent spacing/width reads as intentional; random variation
56+
reads as unfinished, even when users can't say why.
57+
58+
The important nuance — **constrain arbitrary variation, allow meaningful variation:**
59+
60+
- Consistency means "similar things look similar; different things look different." A
61+
focused single-field form *should* be narrower than a wide data table — that difference
62+
is meaningful and helps. That's why this doc allows a few tiers (form / default /
63+
break-out) rather than one width everywhere.
64+
- The reason to avoid a new `4xl`/`5xl`/`6xl` per page isn't that those values are wrong —
65+
it's that picking widths *ad hoc, page by page* produces variation that carries no
66+
meaning. If a genuinely new tier is needed, **add it to the table above** so other pages
67+
can line up with it too, rather than leaving a one-off.
68+
- Don't let consistency calcify a bad default. "We've always done it this way" isn't a
69+
reason; deviate deliberately when a page has a real different need — then promote that
70+
deviation back into the shared set.
71+
72+
## Wide data should break out, not squeeze
73+
74+
The width that's comfortable for forms is too narrow for a wide table. When a page has a
75+
table/code block with many columns, **don't** widen the whole page to fit it — that makes
76+
the forms sprawl too. Instead let the wide element break out of the reading-width column
77+
while the cards/forms stay capped:
78+
79+
```svelte
80+
<div class="container mx-auto max-w-7xl px-4 py-8">
81+
<!-- metadata cards, forms: stay at max-w-7xl -->
82+
83+
<!-- wide table: break out to full viewport width -->
84+
<div class="mb-6">
85+
<div class="overflow-x-auto">
86+
<table class="min-w-full ...">...</table>
87+
</div>
88+
</div>
89+
</div>
90+
```
91+
92+
Always wrap wide tables in `overflow-x-auto` so they scroll horizontally on smaller
93+
screens instead of overflowing the page. Note the scrollbar sits at the *bottom* of the
94+
table — for very tall tables, prefer breaking out / widening so users don't have to find
95+
it, rather than relying on the scroll alone.
96+
97+
## Checklist for a new detail/config page
98+
99+
- [ ] Page wrapper is `container mx-auto max-w-7xl px-4 py-8` (or a narrower cap from the
100+
table above if it's a focused form).
101+
- [ ] Any multi-column table or code/JSON block is wrapped in `overflow-x-auto`.
102+
- [ ] If a table is the widest thing on the page and feels cramped, break it out to full
103+
width rather than bumping the whole page's cap.

0 commit comments

Comments
 (0)