An open source design system that's fully customizable and agent ready
TypeScript
feat(sandbox): add images to library template cards (#1432)
Kenton Quatman580191afcbf9
diff --git a/apps/sandbox/public/templates/library/colorful-home-horizontal-1.png b/apps/sandbox/public/templates/library/colorful-home-horizontal-1.pngnew file mode 100644index 0000000000..ca1ba87a8eBinary files /dev/null and b/apps/sandbox/public/templates/library/colorful-home-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/colorful-home-horizontal-2.png b/apps/sandbox/public/templates/library/colorful-home-horizontal-2.pngnew file mode 100644index 0000000000..368349cbf1Binary files /dev/null and b/apps/sandbox/public/templates/library/colorful-home-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-1.png b/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-1.pngnew file mode 100644index 0000000000..5bbb059232Binary files /dev/null and b/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-2.png b/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-2.pngnew file mode 100644index 0000000000..36b05c1e2eBinary files /dev/null and b/apps/sandbox/public/templates/library/colorful-lifestyle-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/colorful-product-1.png b/apps/sandbox/public/templates/library/colorful-product-1.pngnew file mode 100644index 0000000000..ef70bb7b53Binary files /dev/null and b/apps/sandbox/public/templates/library/colorful-product-1.png differdiff --git a/apps/sandbox/public/templates/library/colorful-product-2.png b/apps/sandbox/public/templates/library/colorful-product-2.pngnew file mode 100644index 0000000000..50bfe70c03Binary files /dev/null and b/apps/sandbox/public/templates/library/colorful-product-2.png differdiff --git a/apps/sandbox/public/templates/library/colorful-working-horizontal-1.png b/apps/sandbox/public/templates/library/colorful-working-horizontal-1.pngnew file mode 100644index 0000000000..249000dea6Binary files /dev/null and b/apps/sandbox/public/templates/library/colorful-working-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/colorful-working-horizontal-2.png b/apps/sandbox/public/templates/library/colorful-working-horizontal-2.pngnew file mode 100644index 0000000000..101be335ceBinary files /dev/null and b/apps/sandbox/public/templates/library/colorful-working-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/colorful-working-horizontal-3.png b/apps/sandbox/public/templates/library/colorful-working-horizontal-3.pngnew file mode 100644index 0000000000..d79e47fcbfBinary files /dev/null and b/apps/sandbox/public/templates/library/colorful-working-horizontal-3.png differdiff --git a/apps/sandbox/public/templates/library/illustrative-horizontal-1.jpg b/apps/sandbox/public/templates/library/illustrative-horizontal-1.jpgnew file mode 100644index 0000000000..e587aba53dBinary files /dev/null and b/apps/sandbox/public/templates/library/illustrative-horizontal-1.jpg differdiff --git a/apps/sandbox/public/templates/library/illustrative-horizontal-2.jpg b/apps/sandbox/public/templates/library/illustrative-horizontal-2.jpgnew file mode 100644index 0000000000..e2158c5c90Binary files /dev/null and b/apps/sandbox/public/templates/library/illustrative-horizontal-2.jpg differdiff --git a/apps/sandbox/public/templates/library/illustrative-horizontal-3.jpg b/apps/sandbox/public/templates/library/illustrative-horizontal-3.jpgnew file mode 100644index 0000000000..9767141cf1Binary files /dev/null and b/apps/sandbox/public/templates/library/illustrative-horizontal-3.jpg differdiff --git a/apps/sandbox/public/templates/library/illustrative-horizontal-4.jpg b/apps/sandbox/public/templates/library/illustrative-horizontal-4.jpgnew file mode 100644index 0000000000..e77033618bBinary files /dev/null and b/apps/sandbox/public/templates/library/illustrative-horizontal-4.jpg differdiff --git a/apps/sandbox/public/templates/library/illustrative-horizontal-5.jpg b/apps/sandbox/public/templates/library/illustrative-horizontal-5.jpgnew file mode 100644index 0000000000..fc67323009Binary files /dev/null and b/apps/sandbox/public/templates/library/illustrative-horizontal-5.jpg differdiff --git a/apps/sandbox/public/templates/library/light-home-horizontal-1.png b/apps/sandbox/public/templates/library/light-home-horizontal-1.pngnew file mode 100644index 0000000000..4d904c3167Binary files /dev/null and b/apps/sandbox/public/templates/library/light-home-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/light-lifestyle-horizontal-1.png b/apps/sandbox/public/templates/library/light-lifestyle-horizontal-1.pngnew file mode 100644index 0000000000..5fa30ee29dBinary files /dev/null and b/apps/sandbox/public/templates/library/light-lifestyle-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/light-scene-horizontal-1.png b/apps/sandbox/public/templates/library/light-scene-horizontal-1.pngnew file mode 100644index 0000000000..c9d63bb0acBinary files /dev/null and b/apps/sandbox/public/templates/library/light-scene-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/light-working-horizontal-1.png b/apps/sandbox/public/templates/library/light-working-horizontal-1.pngnew file mode 100644index 0000000000..32b406ca7aBinary files /dev/null and b/apps/sandbox/public/templates/library/light-working-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/light-working-horizontal-2.png b/apps/sandbox/public/templates/library/light-working-horizontal-2.pngnew file mode 100644index 0000000000..b8a7e91f34Binary files /dev/null and b/apps/sandbox/public/templates/library/light-working-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/light-working-horizontal-3.png b/apps/sandbox/public/templates/library/light-working-horizontal-3.pngnew file mode 100644index 0000000000..58c50a45faBinary files /dev/null and b/apps/sandbox/public/templates/library/light-working-horizontal-3.png differdiff --git a/apps/sandbox/public/templates/library/light-working-horizontal-4.png b/apps/sandbox/public/templates/library/light-working-horizontal-4.pngnew file mode 100644index 0000000000..f98512c5f6Binary files /dev/null and b/apps/sandbox/public/templates/library/light-working-horizontal-4.png differdiff --git a/apps/sandbox/public/templates/library/moody-home-horizontal-1.png b/apps/sandbox/public/templates/library/moody-home-horizontal-1.pngnew file mode 100644index 0000000000..081613ced5Binary files /dev/null and b/apps/sandbox/public/templates/library/moody-home-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/moody-home-horizontal-2.png b/apps/sandbox/public/templates/library/moody-home-horizontal-2.pngnew file mode 100644index 0000000000..df121ca927Binary files /dev/null and b/apps/sandbox/public/templates/library/moody-home-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-1.png b/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-1.pngnew file mode 100644index 0000000000..af704857a0Binary files /dev/null and b/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-2.png b/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-2.pngnew file mode 100644index 0000000000..3a8263766aBinary files /dev/null and b/apps/sandbox/public/templates/library/moody-lifestyle-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/moody-scene-horizontal-1.png b/apps/sandbox/public/templates/library/moody-scene-horizontal-1.pngnew file mode 100644index 0000000000..05115dd7bcBinary files /dev/null and b/apps/sandbox/public/templates/library/moody-scene-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/moody-scene-horizontal-2.png b/apps/sandbox/public/templates/library/moody-scene-horizontal-2.pngnew file mode 100644index 0000000000..e51d32de3bBinary files /dev/null and b/apps/sandbox/public/templates/library/moody-scene-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/moody-working-horizontal-1.png b/apps/sandbox/public/templates/library/moody-working-horizontal-1.pngnew file mode 100644index 0000000000..fe60e424b1Binary files /dev/null and b/apps/sandbox/public/templates/library/moody-working-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/library/moody-working-horizontal-2.png b/apps/sandbox/public/templates/library/moody-working-horizontal-2.pngnew file mode 100644index 0000000000..4acd6feeeaBinary files /dev/null and b/apps/sandbox/public/templates/library/moody-working-horizontal-2.png differdiff --git a/apps/sandbox/public/templates/library/moody-working-horizontal-3.png b/apps/sandbox/public/templates/library/moody-working-horizontal-3.pngnew file mode 100644index 0000000000..4df4c24300Binary files /dev/null and b/apps/sandbox/public/templates/library/moody-working-horizontal-3.png differdiff --git a/packages/cli/templates/pages/library/page.tsx b/packages/cli/templates/pages/library/page.tsxindex dff893b965..1d1ce7a200 100644--- a/packages/cli/templates/pages/library/page.tsx+++ b/packages/cli/templates/pages/library/page.tsx@@ -39,8 +39,11 @@ interface LibraryItem {description: string;category: string;type: 'Component' | 'Pattern' | 'Utility';+ image: string;}+const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '';+const CATEGORIES = ['All', 'Layout', 'Forms', 'Navigation', 'Feedback', 'Data'];const ITEMS: LibraryItem[] = [@@ -51,6 +54,7 @@ const ITEMS: LibraryItem[] = ['Vertical and horizontal stack layouts with configurable gap and alignment.',category: 'Layout',type: 'Component',+ image: 'colorful-home-horizontal-1.png',},{id: '2',@@ -59,6 +63,7 @@ const ITEMS: LibraryItem[] = ['Responsive grid container with auto-fit columns and gap control.',category: 'Layout',type: 'Component',+ image: 'illustrative-horizontal-3.jpg',},{id: '3',@@ -67,6 +72,7 @@ const ITEMS: LibraryItem[] = ['Surface container with optional padding, border, and shadow variants.',category: 'Layout',type: 'Component',+ image: 'light-working-horizontal-2.png',},{id: '4',@@ -74,6 +80,7 @@ const ITEMS: LibraryItem[] = [description: 'Centers its child both horizontally and vertically.',category: 'Layout',type: 'Utility',+ image: 'moody-scene-horizontal-1.png',},{id: '5',@@ -81,6 +88,7 @@ const ITEMS: LibraryItem[] = [description: 'Semantic page section with optional heading and divider.',category: 'Layout',type: 'Pattern',+ image: 'colorful-lifestyle-horizontal-2.png',},{id: '6',@@ -88,6 +96,7 @@ const ITEMS: LibraryItem[] = [description: 'Expandable region with animated height transition.',category: 'Layout',type: 'Component',+ image: 'light-scene-horizontal-1.png',},{id: '7',@@ -96,6 +105,7 @@ const ITEMS: LibraryItem[] = ['Single-line text field with label, placeholder, and validation states.',category: 'Forms',type: 'Component',+ image: 'moody-working-horizontal-1.png',},{id: '8',@@ -103,6 +113,7 @@ const ITEMS: LibraryItem[] = [description: 'Multi-line text field with auto-resize and character count.',category: 'Forms',type: 'Component',+ image: 'colorful-working-horizontal-3.png',},{id: '9',@@ -110,6 +121,7 @@ const ITEMS: LibraryItem[] = [description: 'Checkbox with label, indeterminate state, and group support.',category: 'Forms',type: 'Component',+ image: 'illustrative-horizontal-1.jpg',},{id: '10',@@ -117,6 +129,7 @@ const ITEMS: LibraryItem[] = [description: 'Group of radio buttons with accessible fieldset wrapper.',category: 'Forms',type: 'Component',+ image: 'light-home-horizontal-1.png',},{id: '11',@@ -124,6 +137,7 @@ const ITEMS: LibraryItem[] = [description: 'Toggle switch for binary on/off settings.',category: 'Forms',type: 'Component',+ image: 'moody-home-horizontal-2.png',},{id: '12',@@ -132,6 +146,7 @@ const ITEMS: LibraryItem[] = ['Dropdown or inline option selector with single and multi-select modes.',category: 'Forms',type: 'Component',+ image: 'colorful-product-1.png',},{id: '13',@@ -140,6 +155,7 @@ const ITEMS: LibraryItem[] = ['Horizontal tab navigation with underline indicator and keyboard support.',category: 'Navigation',type: 'Component',+ image: 'illustrative-horizontal-5.jpg',},{id: '14',@@ -147,6 +163,7 @@ const ITEMS: LibraryItem[] = [description: 'Application top bar with logo, nav links, and action slots.',category: 'Navigation',type: 'Pattern',+ image: 'light-working-horizontal-1.png',},{id: '15',@@ -155,6 +172,7 @@ const ITEMS: LibraryItem[] = ['Vertical sidebar navigation with collapsible groups and active states.',category: 'Navigation',type: 'Pattern',+ image: 'moody-lifestyle-horizontal-1.png',},{id: '16',@@ -162,6 +180,7 @@ const ITEMS: LibraryItem[] = [description: 'Path trail navigation with separator and truncation support.',category: 'Navigation',type: 'Component',+ image: 'colorful-home-horizontal-2.png',},{id: '17',@@ -170,6 +189,7 @@ const ITEMS: LibraryItem[] = ['Page navigation with prev/next controls and page count display.',category: 'Navigation',type: 'Component',+ image: 'colorful-working-horizontal-1.png',},{id: '18',@@ -178,6 +198,7 @@ const ITEMS: LibraryItem[] = ['Bottom tab bar for mobile viewports with icon and label slots.',category: 'Navigation',type: 'Pattern',+ image: 'light-working-horizontal-3.png',},{id: '19',@@ -186,6 +207,7 @@ const ITEMS: LibraryItem[] = ['Compact label for status, count, or category with semantic color variants.',category: 'Feedback',type: 'Component',+ image: 'moody-working-horizontal-2.png',},{id: '20',@@ -194,6 +216,7 @@ const ITEMS: LibraryItem[] = ['Full-width alert bar for info, success, warning, and error messages.',category: 'Feedback',type: 'Component',+ image: 'illustrative-horizontal-2.jpg',},{id: '21',@@ -201,6 +224,7 @@ const ITEMS: LibraryItem[] = [description: 'Animated loading indicator with size and color variants.',category: 'Feedback',type: 'Component',+ image: 'colorful-lifestyle-horizontal-1.png',},{id: '22',@@ -208,6 +232,7 @@ const ITEMS: LibraryItem[] = [description: 'Horizontal bar indicating task completion percentage.',category: 'Feedback',type: 'Component',+ image: 'light-lifestyle-horizontal-1.png',},{id: '23',@@ -216,6 +241,7 @@ const ITEMS: LibraryItem[] = ['Small dot indicator for presence, health, or pipeline status.',category: 'Feedback',type: 'Component',+ image: 'moody-home-horizontal-1.png',},{id: '24',@@ -224,6 +250,7 @@ const ITEMS: LibraryItem[] = ['Contextual label that appears on hover with configurable placement.',category: 'Feedback',type: 'Component',+ image: 'colorful-working-horizontal-2.png',},{id: '25',@@ -232,6 +259,7 @@ const ITEMS: LibraryItem[] = ['Feature-rich data table with sorting, selection, and column resizing.',category: 'Data',type: 'Component',+ image: 'illustrative-horizontal-4.jpg',},{id: '26',@@ -240,6 +268,7 @@ const ITEMS: LibraryItem[] = ['User profile image with fallback initials and status dot support.',category: 'Data',type: 'Component',+ image: 'light-working-horizontal-4.png',},{id: '27',@@ -248,6 +277,7 @@ const ITEMS: LibraryItem[] = ['Placeholder shimmer for loading states matching content shapes.',category: 'Data',type: 'Utility',+ image: 'moody-lifestyle-horizontal-2.png',},{id: '28',@@ -255,6 +285,7 @@ const ITEMS: LibraryItem[] = [description: 'Rich popover that appears on hover with arbitrary content.',category: 'Data',type: 'Component',+ image: 'moody-scene-horizontal-2.png',},{id: '29',@@ -263,6 +294,7 @@ const ITEMS: LibraryItem[] = ['Command-palette style search with grouped results and keyboard nav.',category: 'Data',type: 'Pattern',+ image: 'colorful-product-2.png',},{id: '30',@@ -271,6 +303,7 @@ const ITEMS: LibraryItem[] = ['Autocomplete input with async suggestion loading and selection.',category: 'Data',type: 'Component',+ image: 'moody-working-horizontal-3.png',},];@@ -282,6 +315,11 @@ const styles = stylex.create({backgroundColor: colorVars['--color-background-muted'],width: '100%',},+ thumbnailImage: {+ width: '100%',+ height: '100%',+ objectFit: 'cover',+ },cardBody: {padding: spacingVars['--spacing-4'],},@@ -355,8 +393,12 @@ function LibraryNav() {function LibraryCard({item}: {item: LibraryItem}) {return (<XDSCard padding={0}>- <XDSAspectRatio ratio={21 / 9} xstyle={styles.thumbnail}>- <div />+ <XDSAspectRatio ratio={16 / 9} xstyle={styles.thumbnail}>+ <img+ {...stylex.props(styles.thumbnailImage)}+ src={`${basePath}/templates/library/${item.image}`}+ alt={item.name}+ /></XDSAspectRatio><XDSVStack gap={1} xstyle={styles.cardBody}><XDSHeading level={3}>{item.name}</XDSHeading>