Skip to content

Commit 9117845

Browse files
fix(content): tighten SectionList grid to use main-content width
Replace centered flex and 90% width cap with a full-width auto-fill grid so content cards fill the main column without side dead space. Use grid-cell vertical-only margins to prevent horizontal overflow, drop viewport-based card max-width, and consolidate card chrome in shared CSS with a --content-card-min theme token. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ba3c45f commit 9117845

5 files changed

Lines changed: 43 additions & 30 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pendragon-coding': patch
3+
---
4+
5+
Tighten SectionList layout: full-width CSS grid for card sections, remove viewport-capped short-form card width, and use vertical-only card margins in grid cells to prevent horizontal overflow past main-content.

src/components/content/ContentCard.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (isTestimonial && description.includes('<br><br>')) {
2929
const isLinkedIn = (href: string) => href.includes('linkedin.com');
3030
---
3131

32-
<Card variant={cardVariant} id={contentId}>
32+
<Card variant={cardVariant} id={contentId} gridCell={layoutMode === 'grid'}>
3333
{isTestimonial ? (
3434
<div class="testimonial-card">
3535
{/* Quote icon */}

src/components/content/SectionList.astro

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ interface Props {
1616
1717
const { layoutMode, contentKind, content, sectionTitle } = Astro.props;
1818
19-
const baseClasses = ['flex', 'max-w-9/10', 'mx-auto'];
19+
const listLayout = 'w-full gap-4';
20+
const ulClasses =
21+
layoutMode === 'single-column'
22+
? `flex flex-col ${listLayout} items-stretch`
23+
: `grid ${listLayout} min-w-0 grid-cols-[repeat(auto-fill,minmax(min(var(--content-card-min),100%),1fr))]`;
2024
21-
if (layoutMode === 'single-column') {
22-
baseClasses.push('flex-col', 'items-center', 'gap-4');
23-
} else {
24-
baseClasses.push('flex-wrap', 'justify-center');
25-
}
26-
27-
const ulClasses = baseClasses.join(' ');
2825
---
2926

3027
<ul class={ulClasses} role="list">

src/components/ui/Card.astro

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface Props {
66
maxWidth?: string;
77
minWidth?: string;
88
className?: string;
9+
gridCell?: boolean;
910
[key: string]: unknown;
1011
}
1112
@@ -14,34 +15,21 @@ const {
1415
maxWidth = '',
1516
minWidth = '',
1617
className = '',
18+
gridCell = false,
1719
...rest
1820
} = Astro.props;
1921
20-
const baseClasses = [
21-
// Base styles
22-
'outline-solid outline-2 outline-green-700',
23-
'w-full m-4 p-5 rounded-xl',
24-
// bg-green-950 provides a solid dark base so the semi-transparent gradient
25-
// always renders on dark green, not the page body — ensures WCAG AA link contrast
26-
'bg-green-950 bg-gradient-to-br from-green-950/80 to-green-900/40',
27-
28-
// Transitions
29-
'transition-all duration-300',
30-
31-
// Interactive states
32-
'hover:outline-green-500 hover:shadow-lg hover:shadow-green-900/50',
33-
'hover:-translate-y-1 hover:scale-[1.02]',
34-
'focus-within:outline-green-500 focus-within:shadow-lg focus-within:shadow-green-900/50',
35-
'focus-within:-translate-y-1 focus-within:scale-[1.02]',
22+
const fillsCell = variant === 'long-form' || gridCell;
23+
const chromeClasses = [
24+
'card-chrome',
25+
gridCell ? 'card-chrome--grid-cell' : 'card-chrome--inset',
26+
fillsCell ? 'max-w-full' : 'min-w-[min(var(--content-card-min),100%)] max-w-full',
3627
].join(' ');
3728
38-
const sizeStyle =
39-
variant === 'long-form'
40-
? `max-width: 100%; ${minWidth ? `min-width: ${minWidth};` : ''}`
41-
: `min-width: min(360px, 100%); max-width: min(20vw, 100%); ${minWidth ? `min-width: ${minWidth};` : ''}`;
29+
const sizeStyle = minWidth ? `min-width: ${minWidth};` : undefined;
4230
---
4331
<li
44-
class={`${baseClasses} ${maxWidth} ${className}`}
32+
class={`${chromeClasses} ${maxWidth} ${className}`}
4533
style={sizeStyle}
4634
{...rest}
4735
>

src/styles/styles.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
--ease-default: ease;
2424
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
2525
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
26+
27+
/* Content card grid: min track width (SectionList + flex short-form cards) */
28+
--content-card-min: 360px;
2629
}
2730

2831

@@ -336,6 +339,26 @@ p {
336339
border-radius: 0.25rem;
337340
}
338341

342+
/* Shared <li> chrome for Card.astro (content pages + blog) */
343+
.card-chrome {
344+
@apply outline-solid outline-2 outline-green-700 w-full p-5 rounded-xl
345+
bg-green-950 bg-gradient-to-br from-green-950/80 to-green-900/40
346+
transition-all duration-300;
347+
}
348+
349+
.card-chrome:hover,
350+
.card-chrome:focus-within {
351+
@apply outline-green-500 shadow-lg shadow-green-900/50 -translate-y-1 scale-[1.02];
352+
}
353+
354+
.card-chrome--inset {
355+
@apply m-4;
356+
}
357+
358+
.card-chrome--grid-cell {
359+
@apply my-4 mx-0 min-w-0;
360+
}
361+
339362
/* --- Testimonial card styles --- */
340363

341364
.testimonial-card {

0 commit comments

Comments
 (0)