Compare commits

...
Author SHA1 Message Date
ngqileandClaude Opus 5.5 12296ac203 docs: archive add-hero-fits-screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:45:13 +08:00
ngqile 6164263208 Merge pull request 'fix(pages): fit the top bar, hero and trust strip on one desktop screen' (#82) from add-hero-fits-screen into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:45:06 +00:00
ngqileandClaude Opus 5.5 405dab55dd fix(pages): fit the top bar, hero and trust strip on one desktop screen
A trust strip band uses less padding, the full-width hero less padding, and the
landing-page form tighter gaps with the consent in small text. Controls keep
their 44 px height. On the INS page at 1920x1080 the trust strip now ends at
937 px instead of 1077 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:44:55 +08:00
ngqile b6f5fb441e Merge pull request 'docs: archive add-landing-page-polish' (#81) from archive-landing-page-polish into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:28:36 +00:00
ngqileandClaude Opus 5.5 cc2d1c794e docs: archive add-landing-page-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:28:28 +08:00
ngqile c21a31e10f Merge pull request 'feat(pages): a top bar section, section labels and serif headings' (#80) from add-landing-page-polish into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:28:21 +00:00
16 changed files with 192 additions and 6 deletions

No files matched your search

@@ -0,0 +1,22 @@
# Design
## Context
Measured at 1920×1080 on the INS page: top bar 69 px, hero 886 px (set by the form card), trust strip about 122 px, 1077 px in all. The hero grid has `pt-16 pb-12`. Bands get `py-12`. The compact form uses `space-y-4`, and its consent box holds two lines of normal-size text (English and Malay).
## Approaches
1. **Trim spacing (chosen).** Trust band padding, hero padding and the compact form's gaps. It is about 150 px in all, with no field taken away and no setting added.
2. **Side-by-side fields** (Mobile and Email on one row on wide screens). That saves about 80 px more, but the fields get narrower, and the hint and errors under Mobile get harder to lay out. It is kept in reserve.
3. **A form-size setting for staff.** This adds UI for something the page should simply get right.
## Decisions
- The trust band padding is `py-5` only for TRUST. Other bands keep `py-12`.
- The full-width hero grid is `pt-8 pb-8`. The editor's image button still fits in the corner, because it is positioned on the section, not in the padding.
- In the compact form: `space-y-3` between fields, the consent box text is `text-sm`, and the form card's gap is `space-y-3`. The 44 px control heights stay, for touch targets.
- The check is a Playwright measurement at 1920×1080: the bottom of the trust strip at or below 950 px from the top. There is no unit test for pixel heights (jsdom has no layout). Render tests pin the classes instead.
## Risks
- **A tighter consent box is still the consent.** Its text, its checkbox and its required state do not change; only the font size does. `text-sm` (14 px) stays readable.
@@ -0,0 +1,33 @@
# Proposal
## Why
On the INS Hotel technology page (`/p/INS/hotel-technology`), the top bar, the full-width hero with its sign-up form, and the trust strip together are 1077 px tall. A visitor on a 1080p or 1440p desktop sees the trust strip cut off at the bottom of the first screen. The owner wants the hero and the trust strip to fit on one desktop screen. Staff have no way to change the form's size, and the form sets the hero's height.
## What Changes
- **Thinner trust strip.** A trust strip shown as a coloured band uses less padding above and below (about 20 px instead of 48 px), close to INS's 22 px.
- **Less padding in the full-width hero.** It is about 32 px top and bottom, instead of 64 px top and 48 px bottom.
- **Tighter compact form.** The landing-page form (the compact form) has smaller gaps between fields, and the consent box uses small text. The fields, the dropdown and the button keep their 44 px height, so they stay easy to tap.
- **Result.** The INS page's top bar, hero and trust strip fit within 950 px, which shows them in full on a 1920×1080 desktop browser.
Not changing:
- QR, invitation and customer forms.
- Heroes that are not full width, and other band looks.
- Phones, where the hero stacks the form below the text.
- Small laptops (768 px tall). There the form alone is taller than the screen, as on INS's own page.
## Capabilities
### New Capabilities
None.
### Modified Capabilities
- `landing-pages`: adds "First Screen Fits The Hero And Trust Strip".
## Impact
- Portal only: `CmsBlocks.tsx` (trust band padding, full-width hero padding, form card gap) and `RegistrationForm.tsx` (compact spacing and consent text).
- No server, API or data change. No new labels.
@@ -0,0 +1,16 @@
## ADDED Requirements
### Requirement: First Screen Fits The Hero And Trust Strip
A page with a top bar, a full-width hero with its sign-up form, and a trust strip SHALL show all three in full within the first 950 px of a desktop browser window. To fit, the trust strip band SHALL use less padding than other bands, and the landing-page form SHALL keep its fields, dropdown and button at least 44 px tall.
#### Scenario: INS page on a 1080p desktop
- **GIVEN** page `/p/INS/hotel-technology` with a top bar, a full-width hero with a form, and a trust strip
- **WHEN** a visitor opens it in a 1920×1080 browser window
- **THEN** the bottom of the trust strip is within 950 px of the top of the page
#### Scenario: Form controls stay easy to tap
- **WHEN** a visitor opens a landing page with a sign-up form
- **THEN** each text field, the service dropdown and the Register button are at least 44 px tall
@@ -0,0 +1,26 @@
# Tasks
## 1. Portal
- [x] 1.1 `CmsBlocks.tsx`:
- a TRUST band uses `py-5`; other bands keep `py-12`;
- the full-width hero grid uses `pt-8 pb-8`;
- the hero form card uses `space-y-3`.
`RegistrationForm.tsx`, compact only: `space-y-3` between fields, and `text-sm` in the consent box.
Verify: render tests fail first, then pass; vitest exit 0, tsc and lint clean.
## 2. Verification
- [x] 2.1 Use Playwright on port 3001 to measure `/p/INS/hotel-technology` at 1920×1080: the trust strip's bottom is at most 950 px, and the controls are at least 44 px tall. Take screenshots at 1920×1080, 1280×900 and 390 px.
- [x] 2.2 Run `openspec validate add-hero-fits-screen --strict`.
## Notes (2026-12-04)
- **Red first:** the new render tests failed on the trust band padding, the hero padding, the card gap, the compact form gap and the consent text size.
- **Changed existing tests:** none.
- **Measured** on `/p/INS/hotel-technology` at 1920×1080 with Playwright:
- before: hero 886 px, trust strip bottom 1077 px;
- with `pt-10 pb-10`: 953 px, still over the 950 px target, so the hero padding became `pt-8 pb-8`;
- final: hero 802 px, trust strip bottom 937 px. Every text field, the dropdown and the Register button are 44 px.
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-12-04
+56
View File
@@ -790,3 +790,59 @@ Where this spec says text shows contact links, the page SHALL show phone numbers
- **WHEN** a visitor opens the page
- **THEN** "<b>Call</b>" shows as written
- **AND** "+60 12-833 2775" links to `tel:+60128332775`
### Requirement: Top Bar Block
A page's first block MAY be a top bar. The top bar SHALL show the company logo, or the company name when there is no logo, and an optional button, and SHALL stay at the top of the window while the page scrolls. The server SHALL refuse a top bar that is not the first block, or one that carries fields other than its button and link name.
#### Scenario: Logo and button without the page title
- **GIVEN** page `/p/INS/hotel-technology-native` with "hide page header" on, a top bar with the button "Get My Free Consultation" linking to `#consult`, and a full-width hero
- **WHEN** a visitor opens the page and scrolls down
- **THEN** the INS logo and the button stay at the top of the window
- **AND** no page title heading shows, and the hero starts directly under the bar
#### Scenario: Top bar further down is refused
- **WHEN** staff save a page whose top bar is the second block
- **THEN** the save is refused with the reason naming that block
### Requirement: Section Labels
Feature cards, Steps, Image with text, FAQ and Call to action blocks MAY carry a label of at most 40 characters. The page SHALL show the label above the block's heading, in small uppercase letters in the accent colour. The server SHALL refuse a longer label, or a label on any other block type.
#### Scenario: Label above a heading
- **GIVEN** a Feature cards block with the label "Services" and the heading "Everything your guests touch, handled by one team"
- **WHEN** a visitor opens the page
- **THEN** "Services" shows in small uppercase letters directly above the heading
#### Scenario: Type a label in the editor
- **GIVEN** staff editing a Steps block
- **WHEN** they type "How we work" in its label field and save
- **THEN** the page keeps the label
### Requirement: Serif Section Headings
Section headings on landing pages SHALL use the serif typeface that the full-width hero uses.
#### Scenario: Feature heading in serif
- **WHEN** a visitor opens a page with a Feature cards block
- **THEN** its heading uses the serif typeface
### Requirement: First Screen Fits The Hero And Trust Strip
A page with a top bar, a full-width hero with its sign-up form, and a trust strip SHALL show all three in full within the first 950 px of a desktop browser window. To fit, the trust strip band SHALL use less padding than other bands, and the landing-page form SHALL keep its fields, dropdown and button at least 44 px tall.
#### Scenario: INS page on a 1080p desktop
- **GIVEN** page `/p/INS/hotel-technology` with a top bar, a full-width hero with a form, and a trust strip
- **WHEN** a visitor opens it in a 1920×1080 browser window
- **THEN** the bottom of the trust strip is within 950 px of the top of the page
#### Scenario: Form controls stay easy to tap
- **WHEN** a visitor opens a landing page with a sign-up form
- **THEN** each text field, the service dropdown and the Register button are at least 44 px tall
@@ -275,3 +275,20 @@ describe("LandingPage polish", () => {
expect(screen.getByRole("heading", { level: 2, name: "Questions hotels ask us" }).previousElementSibling).toHaveClass("text-primary");
});
});
// add-hero-fits-screen: the top bar, hero and trust strip fit one desktop screen.
describe("LandingPage first screen", () => {
it("gives a trust band less padding than other bands, and the full-width hero less padding", () => {
render(<LandingPage company={company} page={page([
{ type: "HERO", heading: "One partner", fullWidth: true, eventUuid: "77", closed: true },
{ type: "TRUST", look: "MUTED", cards: [{ title: "Design" }, { title: "Local support" }] },
{ type: "CTA", heading: "Talk to us", look: "DARK" },
])} />);
const bands = Array.from(document.querySelectorAll("[data-look]"));
expect(bands[0]).toHaveClass("py-5");
expect(bands[1]).toHaveClass("py-12");
const grid = screen.getByRole("heading", { name: "One partner" }).closest(".grid")!;
expect(grid).toHaveClass("pt-8", "pb-8");
expect(screen.getByText("Sign-up is closed.").closest(".shadow-card")).toHaveClass("space-y-3");
});
});
@@ -90,7 +90,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
// add-hero-signup-form: with an event, the sign-up form sits in a card beside the text (below it on phones).
// add-hero-full-width: the card may open with its own heading and text.
const card = block.eventUuid ? (
<div className="space-y-4 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
<div className="space-y-3 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
{block.formHeading || block.formText || edit ? (
<div className="space-y-1">
<Text as="h3" index={index} path="formHeading" value={block.formHeading} max={80} code="PagesFormHeading" className="font-serif text-2xl font-semibold" />
@@ -104,7 +104,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
if (wide) {
// Edge to edge; the shade is darkest behind the text and clears toward the far side. The text is centred in the
// hero's opening height, not beside a long form, so it stays in the first screen.
const grid = `mx-auto grid w-full max-w-6xl items-start gap-8 px-4 pt-16 pb-12 ${card ? "md:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]" : ""}`;
const grid = `mx-auto grid w-full max-w-6xl items-start gap-8 px-4 pt-8 pb-8 ${card ? "md:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]" : ""}`;
return (
<section className={`relative overflow-hidden ${back}`}>
<ImageSpot index={index} src={image} className="absolute inset-0 h-full w-full object-cover" corner />
@@ -296,7 +296,7 @@ function Section({ block, index, children }: { block: PublicBlock; index: number
if (!band) return <EditSection index={index}><div id={anchorId(block.anchor)} className={`scroll-mt-24 ${WIDTH}`}>{children}</div></EditSection>;
return (
<EditSection index={index}>
<div id={anchorId(block.anchor)} data-look={band} className={`scroll-mt-16 py-12 ${BANDS[band]}`}>
<div id={anchorId(block.anchor)} data-look={band} className={`scroll-mt-16 ${block.type === "TRUST" ? "py-5" : "py-12"} ${BANDS[band]}`}>
<div className={WIDTH}>{children}</div>
</div>
</EditSection>
@@ -46,4 +46,18 @@ describe("RegistrationForm compact", () => {
expect(screen.queryByRole("combobox")).not.toBeInTheDocument();
expect(screen.getByText("English text").closest("details")).toBeNull();
});
// add-hero-fits-screen: tighter spacing, but controls stay 44 px (h-11) for touch.
it("is tighter than the full form, with the consent in small text and 44 px controls", () => {
const { container, unmount } = render(<RegistrationForm {...base} submit={async () => undefined} compact />);
expect(container.querySelector("form")).toHaveClass("space-y-3");
expect(screen.getByText(/I agree to INS/).parentElement).toHaveClass("text-sm");
for (const el of [screen.getByLabelText("Your name"), screen.getByLabelText("Mobile number"), screen.getByRole("combobox"), screen.getByRole("button", { name: "Register" })]) {
expect(el).toHaveClass("h-11");
}
unmount();
const full = render(<RegistrationForm {...base} submit={async () => undefined} />);
expect(full.container.querySelector("form")).toHaveClass("space-y-4");
expect(screen.getByText(/I agree to INS/).parentElement).not.toHaveClass("text-sm");
});
});
@@ -41,7 +41,7 @@ interface Props {
onDone: () => void;
/** The code or invitation was switched off: the page shows its own message. */
onInactive: () => void;
/** add-compact-landing-form: a landing page's short form: no job title, one service dropdown, the notice folded. */
/** add-compact-landing-form: a landing page's short form: no job title, one service dropdown, the notice folded; tighter spacing (add-hero-fits-screen). */
compact?: boolean;
}
@@ -134,7 +134,7 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on
);
return (
<form onSubmit={onSubmit} className="space-y-4" noValidate>
<form onSubmit={onSubmit} className={compact ? "space-y-3" : "space-y-4"} noValidate>
{formError && <p role="alert" className="text-sm text-destructive">{formError}</p>}
{field("name", t("RegName"))}
{field("mobile", t("RegMobile"), "tel", t("RegContactHint"))}
@@ -152,7 +152,7 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on
)}
<Label htmlFor="reg-consent" className={CONSENT_ROW}>
<Checkbox id="reg-consent" className={`${BOX} mt-0.5`} checked={form.consent} onCheckedChange={(on) => set({ consent: on === true })} aria-invalid={!!errors.consent} aria-describedby={errors.consent ? "reg-consent-error" : undefined} />
<span className="space-y-1 font-normal">
<span className={`space-y-1 font-normal ${compact ? "text-sm" : ""}`}>
<span className="block">{t("RegConsentEn", { company: info.companyName })}</span>
<span className="block">{t("RegConsentMs", { company: info.companyName })}</span>
</span>