Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

Polish classic-gallery template (XDS primitives, repo-served images) (#2586)

rubyycheung436624fd3559
diff --git a/apps/docsite/public/template-assets/classic-gallery-lifestyle-architecture.jpg b/apps/docsite/public/template-assets/classic-gallery-lifestyle-architecture.jpg
new file mode 100644
index 0000000000..341b0153c0
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-lifestyle-architecture.jpg differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-backpack.png b/apps/docsite/public/template-assets/classic-gallery-product-backpack.png
new file mode 100644
index 0000000000..673dcb78f9
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-backpack.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-headphones.png b/apps/docsite/public/template-assets/classic-gallery-product-headphones.png
new file mode 100644
index 0000000000..4339238aa6
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-headphones.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-mug.png b/apps/docsite/public/template-assets/classic-gallery-product-mug.png
new file mode 100644
index 0000000000..391aa74cda
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-mug.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-throw.png b/apps/docsite/public/template-assets/classic-gallery-product-throw.png
new file mode 100644
index 0000000000..8b6c6d8dbb
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-throw.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-wallet.png b/apps/docsite/public/template-assets/classic-gallery-product-wallet.png
new file mode 100644
index 0000000000..99040320af
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-wallet.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-product-watch.png b/apps/docsite/public/template-assets/classic-gallery-product-watch.png
new file mode 100644
index 0000000000..6930b32b54
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-product-watch.png differ
diff --git a/apps/docsite/public/template-assets/classic-gallery-working-together.png b/apps/docsite/public/template-assets/classic-gallery-working-together.png
new file mode 100644
index 0000000000..175e700cac
Binary files /dev/null and b/apps/docsite/public/template-assets/classic-gallery-working-together.png differ
diff --git a/packages/cli/templates/pages/classic-gallery/page.tsx b/packages/cli/templates/pages/classic-gallery/page.tsx
index 76e41a1bcd..9fb84dca79 100644
--- a/packages/cli/templates/pages/classic-gallery/page.tsx
+++ b/packages/cli/templates/pages/classic-gallery/page.tsx
@@ -8,30 +8,29 @@ import {XDSCenter} from '@xds/core/Center';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSGrid} from '@xds/core/Grid';
import {XDSSection} from '@xds/core/Section';
+import {XDSAspectRatio} from '@xds/core/AspectRatio';
import {XDSTabList, XDSTab} from '@xds/core/TabList';
import * as stylex from '@stylexjs/stylex';
// ─── Styles ─────────────────────────────────────────────────────────────────
+// Width + centering come from XDSLayout's contentWidth prop. The remaining
+// styles cover things with no XDS prop equivalent: asymmetric page padding,
+// image cover-fit, frame radius, and header text-align.
const styles = stylex.create({
- outer: {
- maxWidth: 1200,
- width: '100%',
- paddingInline: 'var(--spacing-6)',
+ // Page padding lives on the inner content so it isn't canceled by
+ // XDSLayout's negative-margin "escape container padding" behavior.
+ pagePadding: {
paddingBlock: 'var(--spacing-8)',
- },
- imageWrapper: {
- position: 'relative',
- aspectRatio: '3/2',
- borderRadius: 'var(--radius-container)',
- overflow: 'clip',
+ paddingInline: 'var(--spacing-6)',
},
textCenter: {
textAlign: 'center',
},
+ imageFrame: {
+ borderRadius: 'var(--radius-container)',
+ },
imgFill: {
- position: 'absolute',
- inset: 0,
width: '100%',
height: '100%',
objectFit: 'cover',
@@ -40,74 +39,54 @@ const styles = stylex.create({
// ─── Gallery Data ───────────────────────────────────────────────────────────
-type Category = 'all' | 'lifestyle' | 'scene' | 'home';
+type Category = 'all' | 'lifestyle' | 'products';
interface GalleryImage {
src: string;
alt: string;
- category: Category;
+ category: Exclude<Category, 'all'>;
}
const GALLERY_IMAGES: GalleryImage[] = [
{
- // moody-scene-horizontal-1 from xds_oss asset set
- src: '/template-assets/moody-scene-horizontal-1.png',
- alt: 'Moody scene landscape',
- category: 'scene',
- },
- {
- // moody-lifestyle-vertical-1 from xds_oss asset set
- src: '/template-assets/moody-lifestyle-vertical-1.png',
- alt: 'Moody lifestyle portrait',
+ src: '/template-assets/classic-gallery-working-together.png',
+ alt: 'Two colleagues reviewing work on a laptop together',
category: 'lifestyle',
},
{
- // moody-home-vertical-1 from xds_oss asset set
- src: '/template-assets/moody-home-vertical-1.png',
- alt: 'Moody home interior',
- category: 'home',
- },
- {
- // moody-scene-horizontal-2 from xds_oss asset set
- src: '/template-assets/moody-scene-horizontal-2.png',
- alt: 'Moody scene vista',
- category: 'scene',
+ src: '/template-assets/classic-gallery-lifestyle-architecture.jpg',
+ alt: 'Soft blush curved architecture against a pale sky',
+ category: 'lifestyle',
},
{
- // moody-lifestyle-vertical-2 from xds_oss asset set
- src: '/template-assets/moody-lifestyle-vertical-2.png',
- alt: 'Moody lifestyle scene',
- category: 'lifestyle',
+ src: '/template-assets/classic-gallery-product-backpack.png',
+ alt: 'Charcoal canvas backpack against a neutral backdrop',
+ category: 'products',
},
{
- // moody-lifestyle-horizontal-1 from xds_oss asset set
- src: '/template-assets/moody-lifestyle-horizontal-1.png',
- alt: 'Moody lifestyle horizontal',
- category: 'lifestyle',
+ src: '/template-assets/classic-gallery-product-headphones.png',
+ alt: 'Over-ear headphones resting beside a stone riser',
+ category: 'products',
},
{
- // moody-scene-vertical-1 from xds_oss asset set
- src: '/template-assets/moody-scene-vertical-1.png',
- alt: 'Moody scene vertical',
- category: 'scene',
+ src: '/template-assets/classic-gallery-product-mug.png',
+ alt: 'Matte graphite insulated travel mug',
+ category: 'products',
},
{
- // moody-home-vertical-2 from xds_oss asset set
- src: '/template-assets/moody-home-vertical-2.png',
- alt: 'Moody home vertical',
- category: 'home',
+ src: '/template-assets/classic-gallery-product-throw.png',
+ alt: 'Folded linen throw blanket with fringed edges',
+ category: 'products',
},
{
- // moody-home-horizontal-1 from xds_oss asset set
- src: '/template-assets/moody-home-horizontal-1.png',
- alt: 'Moody home horizontal',
- category: 'home',
+ src: '/template-assets/classic-gallery-product-wallet.png',
+ alt: 'Slim leather bifold wallet on a neutral surface',
+ category: 'products',
},
{
- // moody-scene-vertical-2 from xds_oss asset set
- src: '/template-assets/moody-scene-vertical-2.png',
- alt: 'Moody scene vertical',
- category: 'scene',
+ src: '/template-assets/classic-gallery-product-watch.png',
+ alt: 'Minimalist watch with two interchangeable straps',
+ category: 'products',
},
];
@@ -124,53 +103,54 @@ export default function ClassicGalleryTemplate() {
return (
<XDSLayout
height="auto"
+ contentWidth={1200}
content={
<XDSLayoutContent padding={0}>
- <XDSCenter axis="horizontal">
- <XDSVStack gap={8} xstyle={styles.outer}>
- {/* Header */}
- <XDSCenter axis="horizontal">
- <XDSSection variant="transparent" maxWidth={680} padding={0}>
- <XDSVStack gap={4} hAlign="center" xstyle={styles.textCenter}>
- <XDSVStack gap={2} hAlign="center">
- <XDSHeading level={1}>
- Make every day a little more delightful, one detail at a
- time.
- </XDSHeading>
- <XDSText type="body" color="secondary">
- We believe the smallest details are the ones that matter
- most. A little color, a thoughtful touch, a moment that
- catches your eye and makes you pause; that&apos;s what
- turns an ordinary day into something worth remembering.
- </XDSText>
- </XDSVStack>
-
- <XDSTabList
- value={filter}
- onChange={v => setFilter(v as Category)}>
- <XDSTab value="all" label="All" />
- <XDSTab value="lifestyle" label="Lifestyle" />
- <XDSTab value="scene" label="Scenery" />
- <XDSTab value="home" label="Home" />
- </XDSTabList>
+ <XDSVStack gap={8} xstyle={styles.pagePadding}>
+ {/* Header */}
+ <XDSCenter axis="horizontal">
+ <XDSSection variant="transparent" maxWidth={680} padding={0}>
+ <XDSVStack gap={4} hAlign="center" xstyle={styles.textCenter}>
+ <XDSVStack gap={2} hAlign="center">
+ <XDSHeading level={1}>
+ Make every day a little more delightful, one detail at a
+ time.
+ </XDSHeading>
+ <XDSText type="body" color="secondary">
+ We believe the smallest details are the ones that matter
+ most. A little color, a thoughtful touch, a moment that
+ catches your eye and makes you pause; that&apos;s what
+ turns an ordinary day into something worth remembering.
+ </XDSText>
</XDSVStack>
- </XDSSection>
- </XDSCenter>
- {/* Gallery Grid */}
- <XDSGrid columns={{minWidth: 400}} gap={4}>
- {filteredImages.map((image, i) => (
- <div key={i} {...stylex.props(styles.imageWrapper)}>
- <img
- src={image.src}
- alt={image.alt}
- {...stylex.props(styles.imgFill)}
- />
- </div>
- ))}
- </XDSGrid>
- </XDSVStack>
- </XDSCenter>
+ <XDSTabList
+ value={filter}
+ onChange={v => setFilter(v as Category)}>
+ <XDSTab value="all" label="All" />
+ <XDSTab value="lifestyle" label="Lifestyle" />
+ <XDSTab value="products" label="Products" />
+ </XDSTabList>
+ </XDSVStack>
+ </XDSSection>
+ </XDSCenter>
+
+ {/* Gallery Grid */}
+ <XDSGrid columns={{minWidth: 400}} gap={4}>
+ {filteredImages.map((image, i) => (
+ <XDSAspectRatio
+ key={i}
+ ratio={3 / 2}
+ xstyle={styles.imageFrame}>
+ <img
+ src={image.src}
+ alt={image.alt}
+ {...stylex.props(styles.imgFill)}
+ />
+ </XDSAspectRatio>
+ ))}
+ </XDSGrid>
+ </XDSVStack>
</XDSLayoutContent>
}
/>
diff --git a/packages/cli/templates/pages/classic-gallery/template.doc.mjs b/packages/cli/templates/pages/classic-gallery/template.doc.mjs
index 1afde28154..3289481256 100644
--- a/packages/cli/templates/pages/classic-gallery/template.doc.mjs
+++ b/packages/cli/templates/pages/classic-gallery/template.doc.mjs
@@ -2,9 +2,10 @@
/** @type {import('../../../../core/src/docs-types').TemplateDoc} */
export const doc = {
- name: 'Basic',
- displayName: 'Basic',
- description: 'Clean 2×2 image grid with uniform sizing',
+ name: 'Classic Gallery',
+ displayName: 'Classic Gallery',
+ description:
+ 'Responsive image gallery with a centered intro header and category filter tabs.',
type: 'page',
isReady: true,
category: 'Gallery - Basic',