An open source design system that's fully customizable and agent ready
TypeScript
refactor(templates): pure-XDS, responsive side-gallery (grade 70→85) (#2617)
rubyycheung4fb82bf12fe5
diff --git a/packages/cli/templates/pages/side-gallery/page.tsx b/packages/cli/templates/pages/side-gallery/page.tsxindex 1b09d84300..5741ba7530 100644--- a/packages/cli/templates/pages/side-gallery/page.tsx+++ b/packages/cli/templates/pages/side-gallery/page.tsx@@ -8,8 +8,6 @@ import {XDSLayout,XDSLayoutContent,} from '@xds/core/Layout';-import {XDSCenter} from '@xds/core/Center';-import {XDSSection} from '@xds/core/Section';import {XDSText, XDSHeading} from '@xds/core/Text';import {XDSButton} from '@xds/core/Button';import {XDSAspectRatio} from '@xds/core/AspectRatio';@@ -17,22 +15,16 @@ import {XDSGrid} from '@xds/core/Grid';import {XDSDivider} from '@xds/core/Divider';import * as stylex from '@stylexjs/stylex';-// ─── Styles ─────────────────────────────────────────────────────────────────+// Image fill is a plain inline style (not stylex) so it survives the playground+// preview's runtime TS compile, which doesn't run the StyleX babel plugin.+const imageStyle = {+ width: '100%',+ height: '100%',+ objectFit: 'cover' as const,+};const styles = stylex.create({- splitLayout: {- display: 'grid',- gridTemplateColumns: '1fr 1.5fr',- gap: 'var(--spacing-7)',- alignItems: 'center',- '@media (max-width: 768px)': {- gridTemplateColumns: '1fr',- },- },- image: {- width: '100%',- height: '100%',- objectFit: 'cover',+ imageClip: {borderRadius: 'var(--radius-element)',},});@@ -100,9 +92,9 @@ function StatBlock({value, label}: {value: string; label: string}) {function ImageGrid() {return (<XDSGrid columns={3} gap={3}>- {IMAGES.map((img, i) => (- <XDSAspectRatio key={i} ratio={1}>- <img src={img.src} alt={img.alt} {...stylex.props(styles.image)} />+ {IMAGES.map(img => (+ <XDSAspectRatio key={img.src} ratio={1} xstyle={styles.imageClip}>+ <img src={img.src} alt={img.alt} style={imageStyle} /></XDSAspectRatio>))}</XDSGrid>@@ -115,51 +107,47 @@ export default function SideGalleryTemplate() {return (<XDSLayoutheight="auto"+ contentWidth={1400}content={- <XDSLayoutContent padding={0}>- <XDSCenter axis="horizontal">- <XDSSection variant="transparent" maxWidth={1400} padding={6}>- <div {...stylex.props(styles.splitLayout)}>- {/* Left side: Text + CTA */}- <XDSVStack gap={6} vAlign="center">- <XDSVStack gap={3}>- <XDSText- type="supporting"- color="secondary"- weight="semibold">- COLORFUL- </XDSText>- <XDSHeading level={1}>- Make every day a little more delightful, one small detail- at a time.- </XDSHeading>- <XDSText type="body" color="secondary">- The smallest details are the ones that matter most. A- little color that catches your eye and makes you pause;- that's what turns an ordinary day into something- worth remembering.- </XDSText>- </XDSVStack>+ <XDSLayoutContent padding={6}>+ <XDSGrid+ columns={{minWidth: 360, repeat: 'fit'}}+ gap={8}+ align="center">+ {/* Left side: Text + CTA */}+ <XDSVStack gap={6} vAlign="center">+ <XDSVStack gap={3}>+ <XDSText type="supporting" color="secondary" weight="semibold">+ COLORFUL+ </XDSText>+ <XDSHeading level={1}>+ Make every day a little more delightful, one small detail at a+ time.+ </XDSHeading>+ <XDSText type="body" color="secondary">+ The smallest details are the ones that matter most. A little+ color that catches your eye and makes you pause; that's+ what turns an ordinary day into something worth remembering.+ </XDSText>+ </XDSVStack>- <XDSHStack gap={3} vAlign="center">- <XDSButton label="Explore" variant="primary" />- </XDSHStack>+ <XDSHStack gap={3} vAlign="center">+ <XDSButton label="Explore" variant="primary" />+ </XDSHStack>- <XDSVStack gap={4}>- <XDSDivider />- <XDSHStack gap={6}>- <StatBlock value="12k+" label="Photos" />- <StatBlock value="350+" label="Projects" />- <StatBlock value="8yrs" label="Experience" />- </XDSHStack>- </XDSVStack>- </XDSVStack>+ <XDSVStack gap={4}>+ <XDSDivider />+ <XDSHStack gap={6}>+ <StatBlock value="12k+" label="Photos" />+ <StatBlock value="350+" label="Projects" />+ <StatBlock value="8yrs" label="Experience" />+ </XDSHStack>+ </XDSVStack>+ </XDSVStack>- {/* Right side: Image Grid */}- <ImageGrid />- </div>- </XDSSection>- </XDSCenter>+ {/* Right side: Image Grid */}+ <ImageGrid />+ </XDSGrid></XDSLayoutContent>}/>diff --git a/packages/cli/templates/pages/side-gallery/template.doc.mjs b/packages/cli/templates/pages/side-gallery/template.doc.mjsindex 2019f47be4..7f4ac74ca9 100644--- a/packages/cli/templates/pages/side-gallery/template.doc.mjs+++ b/packages/cli/templates/pages/side-gallery/template.doc.mjs@@ -2,8 +2,8 @@/** @type {import('../../../../core/src/docs-types').TemplateDoc} */export const doc = {- name: 'Side',- displayName: 'Side',+ name: 'Side Gallery',+ displayName: 'Side Gallery',description: 'Text and CTA on the left with an image collage on the right',type: 'page',isReady: true,