Skip to content

Commit 08c472b

Browse files
committed
PageHeroHighlights - Rename a prop
1 parent e998749 commit 08c472b

5 files changed

Lines changed: 51 additions & 39 deletions

File tree

.claude/skills/components/page-hero-highlights.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ The layout uses a 4-row CSS Grid with `subgrid` — no `translate`, negative mar
1717
| `tag` | `"div" \| "section" \| "main"` | `"div"` | Root element tag |
1818
| `highlightsEqualWidths` | `boolean` | `false` | Equal-width grid columns for highlight items |
1919
| `highlightsJustify` | `"start" \| "center" \| "end" \| "space-between" \| "space-around"` | `"start"` | Alignment of highlight items along the main axis |
20-
| `maxWidth` | `boolean` | `false` | When `true`, caps the central column at `--max-width` (default `1064px`). Gutters grow responsively to enforce the constraint. |
21-
| `contentAlign` | `"start" \| "center"` | `"center"` | When `maxWidth` is `true`: `"center"` grows gutters equally; `"start"` pins content to the left with a fixed left gutter. |
20+
| `widthConstrained` | `boolean` | `false` | When `true`, caps the central column at `--width-constrained` (default `1064px`). Gutters grow responsively to enforce the constraint. |
21+
| `contentAlign` | `"start" \| "center"` | `"center"` | When `widthConstrained` is `true`: `"center"` grows gutters equally; `"start"` pins content to the left with a fixed left gutter. |
2222
| `contentPanel` | `boolean` | `true` | When `true`, renders a decorative panel behind the content slot and offsets the highlights strip. Set to `false` for a flat layout with no backdrop. |
2323
| `highlightTitleBaseline`| `boolean` | `false` | When `true`, fixes the highlight title row to a set height so titles align at a common baseline. Override `--highlight-title-height` to tune. |
2424
| `styleClassPassthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
@@ -66,7 +66,7 @@ Each slot accepts any content, but these library components are natural fits:
6666
Example with `HeroText` in the header slot:
6767

6868
```vue
69-
<PageHeroHighlights tag="section" :max-width="true">
69+
<PageHeroHighlights tag="section" :width-constrained="true">
7070
<template #header="{ headingId }">
7171
<HeroText :heading-id="headingId" text="Welcome back" accent-text="Simon" />
7272
</template>
@@ -172,26 +172,26 @@ By default, highlight items size to their content (`flex-wrap`). Pass `:highligh
172172

173173
## Constraining the central column width
174174

175-
Pass `:max-width="true"` to cap the content column at `--max-width` (default `1064px`). The gutters grow responsively to enforce it — full-bleed backgrounds are unaffected and `subgrid` continues to work. Use `content-align` to pin to the left or centre:
175+
Pass `:width-constrained="true"` to cap the content column at `--width-constrained` (default `1064px`). The gutters grow responsively to enforce it — full-bleed backgrounds are unaffected and `subgrid` continues to work. Use `content-align` to pin to the left or centre:
176176

177177
```vue
178-
<!-- Centred, capped at --max-width (1064px) -->
179-
<PageHeroHighlights :max-width="true" content-align="center">...</PageHeroHighlights>
178+
<!-- Centred, capped at --width-constrained (1064px) -->
179+
<PageHeroHighlights :width-constrained="true" content-align="center">...</PageHeroHighlights>
180180
181181
<!-- Left-pinned (right side takes remaining space) -->
182-
<PageHeroHighlights :max-width="true" content-align="start">...</PageHeroHighlights>
182+
<PageHeroHighlights :width-constrained="true" content-align="start">...</PageHeroHighlights>
183183
```
184184

185185
The maximum width value and gutter sizes are all CSS tokens — override them via `styleClassPassthrough` if you need different values:
186186

187187
```css
188188
.my-page-hero {
189-
--max-width: 1200px;
189+
--width-constrained: 1200px;
190190
--page-hero-highlights-gutter-desktop: 48px;
191191
}
192192
```
193193

194-
See [css-grid-max-width-gutters.md](../css-grid-max-width-gutters.md) for the underlying pattern explanation.
194+
See [css-grid-width-constrained-gutters.md](../css-grid-width-constrained-gutters.md) for the underlying pattern explanation.
195195

196196
## Local style override scaffold
197197

@@ -211,7 +211,7 @@ See [component-local-style-override.md](../component-local-style-override.md) fo
211211
.page-hero-highlights {
212212
&.my-page-hero {
213213
/* Grid layout */
214-
/* --max-width: 1064px; */
214+
/* --width-constrained: 1064px; */
215215
/* --page-hero-highlights-gutter-mobile: 16px; */
216216
/* --page-hero-highlights-gutter-tablet: 40px; */
217217
/* --page-hero-highlights-gutter-desktop: 32px; */
@@ -269,7 +269,7 @@ row4: page content (never underflows highlights)
269269
`.header-row` spans cols 1–3, rows 1–2 (edge-to-edge bg). `.header-slot` is placed in row 1 only.
270270
`.content-row` spans cols 1–3, rows 3–4 (bg fills behind highlights; `.content-slot` is placed in row 4 only). The decorative border behind `.content-slot` is rendered via `.content-row:before` — there is no separate DOM element for it.
271271

272-
Grid columns are determined entirely by CSS — no `v-bind`. The `maxWidth` and `contentAlign` props add CSS classes (`max-width`, `start`, `center`) which select the appropriate `grid-template-columns` rule.
272+
Grid columns are determined entirely by CSS — no `v-bind`. The `widthConstrained` and `contentAlign` props add CSS classes (`width-constrained`, `start`, `center`) which select the appropriate `grid-template-columns` rule.
273273

274274
## Layout pitfall: do not use `grid-template-rows: subgrid` inside `.highlights-row`
275275

@@ -297,5 +297,5 @@ The `.highlights-row` element spans rows 2–3 of the parent grid (the "straddle
297297
- Component is auto-imported in Nuxt — no import needed.
298298
- Lives in `app/components/04.templates/page-hero-highlights/`.
299299
- Storybook title: `"Templates/PageHeroHighlights"`.
300-
- **`contentAlign` has no effect when `maxWidth` is `false`** — both gutters hold their responsive default.
300+
- **`contentAlign` has no effect when `widthConstrained` is `false`** — both gutters hold their responsive default.
301301
- **Gutter sizes are CSS tokens**`--page-hero-highlights-gutter-mobile/tablet/desktop` are all overridable. The responsive switching between them (via `@container`) is handled internally and cannot be overridden.

app/assets/styles/setup/01.config/_head.css

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,31 @@ html {
1515
transition:
1616
background-color 0.4s ease,
1717
color 0.4s ease;
18-
/* scrollbar-gutter: stable; */
18+
scrollbar-gutter: stable;
1919

2020
overflow-x: clip;
21-
}
22-
body {
23-
background-color: var(--page-bg, lightgray);
24-
color: var(--colour-text-default);
25-
font-family: var(--font-family);
26-
font-size: var(--step-4);
27-
min-height: 100dvh;
28-
transition:
29-
background-color 0.4s ease,
30-
color 0.4s ease;
3121

32-
overflow-x: clip;
22+
body {
23+
background-color: var(--page-bg, lightgray);
24+
color: var(--colour-text-default);
25+
font-family: var(--font-family);
26+
font-size: var(--step-4);
27+
/* min-height: 100dvh; */
28+
transition:
29+
background-color 0.4s ease,
30+
color 0.4s ease;
31+
32+
overflow-x: clip;
33+
34+
#__nuxt {
35+
height: 100%;
36+
div {
37+
.page-layout {
38+
min-block-size: 100svh;
39+
display: grid;
40+
grid-template-rows: auto 1fr auto;
41+
}
42+
}
43+
}
44+
}
3345
}

app/components/04.templates/page-hero-highlights/PageHeroHighlights.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface Props {
2626
tag?: "div" | "section" | "main";
2727
highlightsEqualWidths?: boolean;
2828
highlightsJustify?: "start" | "center" | "end" | "space-between" | "space-around";
29-
maxWidth?: boolean;
29+
widthConstrained?: boolean;
3030
contentAlign?: "start" | "center";
3131
contentPanel?: boolean;
3232
highlightTitleBaseline?: boolean;
@@ -37,7 +37,7 @@ const props = withDefaults(defineProps<Props>(), {
3737
tag: "div",
3838
highlightsEqualWidths: false,
3939
highlightsJustify: "start",
40-
maxWidth: false,
40+
widthConstrained: false,
4141
contentAlign: "center",
4242
contentPanel: true,
4343
highlightTitleBaseline: false,
@@ -48,7 +48,7 @@ const { headingId, ariaLabelledby } = useAriaLabelledById(() => props.tag);
4848
const componentClasses = computed(() => ({
4949
"highlight-title-baseline": props.highlightTitleBaseline,
5050
[props.contentAlign]: true,
51-
"max-width": props.maxWidth,
51+
"width-constrained": props.widthConstrained,
5252
"has-content-panel": props.contentPanel,
5353
}));
5454
@@ -124,11 +124,11 @@ watch(
124124
grid-template-rows: auto var(--highlight-title-height) 1fr auto;
125125
gap: 0;
126126
127-
&.max-width {
127+
&.width-constrained {
128128
grid-template-columns: var(--page-hero-highlights-gutter) 1fr var(--page-hero-highlights-gutter);
129129
}
130130
131-
&:not(.max-width) {
131+
&:not(.width-constrained) {
132132
&.start {
133133
grid-template-columns: var(--page-hero-highlights-gutter) minmax(0, var(--max-width)) minmax(
134134
var(--page-hero-highlights-gutter),

app/components/04.templates/page-hero-highlights/stories/PageHeroHighlights.stories.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type StoryArgs = {
66
tag?: "div" | "section" | "main";
77
highlightsEqualWidths?: boolean;
88
highlightsJustify?: "start" | "center" | "end" | "space-between" | "space-around";
9-
maxWidth?: boolean;
9+
widthConstrained?: boolean;
1010
contentAlign?: "start" | "center";
1111
contentPanel?: boolean;
1212
highlightTitleBaseline?: boolean;
@@ -34,7 +34,7 @@ const meta: Meta<StoryArgs> = {
3434
options: ["start", "center", "end", "space-between", "space-around"],
3535
description: "Justification of highlight items along the main axis",
3636
},
37-
maxWidth: {
37+
widthConstrained: {
3838
control: "boolean",
3939
description:
4040
"When true, caps the central column at --max-width (default 1064px). Gutters grow responsively to enforce the constraint. Override --max-width via styleClassPassthrough to change the cap value.",
@@ -77,7 +77,7 @@ const meta: Meta<StoryArgs> = {
7777
tag: "div",
7878
highlightsEqualWidths: false,
7979
highlightsJustify: "start",
80-
maxWidth: false,
80+
widthConstrained: false,
8181
contentAlign: "center",
8282
contentPanel: true,
8383
highlightTitleBaseline: false,
@@ -344,7 +344,7 @@ export const NoSlotContent: Story = {
344344
/** Max width centered — content column capped at --max-width (1064px) with equal growing gutters either side. */
345345
export const MaxWidthCentered: Story = {
346346
name: "Max Width — Centered",
347-
args: { maxWidth: true, contentAlign: "center" },
347+
args: { widthConstrained: true, contentAlign: "center" },
348348
render: (args: StoryArgs) => ({
349349
components: { PageHeroHighlights },
350350
setup() {
@@ -384,7 +384,7 @@ export const MaxWidthCentered: Story = {
384384
/** Max width start — content column capped at --max-width (1064px), pinned to the left. */
385385
export const MaxWidthStart: Story = {
386386
name: "Max Width — Start",
387-
args: { maxWidth: true, contentAlign: "start" },
387+
args: { widthConstrained: true, contentAlign: "start" },
388388
render: (args: StoryArgs) => ({
389389
components: { PageHeroHighlights },
390390
setup() {

app/components/04.templates/page-hero-highlights/tests/PageHeroHighlights.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,16 @@ describe("PageHeroHighlights", () => {
174174
expect(wrapper.find(".page-hero-highlights").classes()).toContain("center");
175175
});
176176

177-
it("does not apply max-width class by default", async () => {
177+
it("does not apply width-constrained class by default", async () => {
178178
const wrapper = await mountSuspended(PageHeroHighlights);
179-
expect(wrapper.find(".page-hero-highlights").classes()).not.toContain("max-width");
179+
expect(wrapper.find(".page-hero-highlights").classes()).not.toContain("width-constrained");
180180
});
181181

182-
it("applies max-width class when maxWidth is true", async () => {
182+
it("applies width-constrained class when widthConstrained is true", async () => {
183183
const wrapper = await mountSuspended(PageHeroHighlights, {
184-
props: { maxWidth: true },
184+
props: { widthConstrained: true },
185185
});
186-
expect(wrapper.find(".page-hero-highlights").classes()).toContain("max-width");
186+
expect(wrapper.find(".page-hero-highlights").classes()).toContain("width-constrained");
187187
});
188188

189189
it("applies start class when contentAlign is start", async () => {

0 commit comments

Comments
 (0)