An open source design system that's fully customizable and agent ready
TypeScript
fix(templates): responsive widths on small screens (login cards + classic-gallery) (#2801)
rubyycheung31b9696d334a
diff --git a/packages/cli/templates/pages/classic-gallery/page.tsx b/packages/cli/templates/pages/classic-gallery/page.tsxindex 1fd86ea50e..961b58b62e 100644--- a/packages/cli/templates/pages/classic-gallery/page.tsx+++ b/packages/cli/templates/pages/classic-gallery/page.tsx@@ -148,7 +148,7 @@ export default function ClassicGalleryTemplate() {</XDSCenter>{/* Gallery Grid */}- <XDSGrid columns={{minWidth: 400}} gap={4}>+ <XDSGrid columns={{minWidth: 260, repeat: 'fit'}} gap={4}>{filteredImages.map((image, i) => (<div key={i} {...stylex.props(styles.imageWrapper)}><imgdiff --git a/packages/cli/templates/pages/login-card/page.tsx b/packages/cli/templates/pages/login-card/page.tsxindex 5036311168..caa28c999d 100644--- a/packages/cli/templates/pages/login-card/page.tsx+++ b/packages/cli/templates/pages/login-card/page.tsx@@ -14,7 +14,7 @@ import {XDSCard} from '@xds/core/Card';import {XDSLink} from '@xds/core/Link';import {XDSDivider} from '@xds/core/Divider';import {XDSIcon} from '@xds/core/Icon';-import {colorVars} from '@xds/core/theme/tokens.stylex';+import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';// Brand sign-in marks — no heroicons or template-assets equivalent.const AppleIcon = (props: React.SVGProps<SVGSVGElement>) => (@@ -61,6 +61,13 @@ const styles = stylex.create({page: {minHeight: '100%',backgroundColor: colorVars['--color-background-body'],+ padding: spacingVars['--spacing-6'],+ },+ // Cap the column at 400px but let it shrink to fit narrow screens (XDSStack+ // has no maxWidth prop, so it's set here).+ content: {+ width: '100%',+ maxWidth: 400,},});@@ -85,7 +92,7 @@ export default function LoginSimple() {return (<XDSCenter axis="both" xstyle={styles.page}>- <XDSVStack gap={4} hAlign="center">+ <XDSVStack gap={4} hAlign="center" xstyle={styles.content}>{/* Logo */}<XDSVStack gap={2} hAlign="center"><XDSIcon icon={CubeIcon} size="lg" />@@ -95,7 +102,7 @@ export default function LoginSimple() {</XDSVStack>{/* Card */}- <XDSCard padding={8} width={400}>+ <XDSCard padding={8} width="100%"><XDSVStack gap={4} hAlign="stretch">{/* Header */}<XDSVStack gap={1} hAlign="center">@@ -192,7 +199,7 @@ export default function LoginSimple() {</XDSCard>{/* Terms */}- <XDSVStack hAlign="center" width={400}>+ <XDSVStack hAlign="center" width="100%"><XDSText type="supporting" color="secondary" justify="center">By clicking continue, you agree to our{' '}<XDSLink href="#" type="supporting">diff --git a/packages/cli/templates/pages/login-sso/page.tsx b/packages/cli/templates/pages/login-sso/page.tsxindex 3a8e4f0c79..62df2c4c19 100644--- a/packages/cli/templates/pages/login-sso/page.tsx+++ b/packages/cli/templates/pages/login-sso/page.tsx@@ -16,6 +16,7 @@ import {XDSLink} from '@xds/core/Link';import {XDSDivider} from '@xds/core/Divider';import {XDSIcon} from '@xds/core/Icon';import {XDSAvatar} from '@xds/core/Avatar';+import {spacingVars} from '@xds/core/theme/tokens.stylex';// ---------------------------------------------------------------------------// Styles@@ -29,6 +30,7 @@ const styles = stylex.create({backgroundImage: `url(${BG_URL})`,backgroundSize: 'cover',backgroundPosition: 'center',+ padding: spacingVars['--spacing-6'],},});@@ -101,7 +103,7 @@ export default function LoginSSO() {return (<XDSCenter axis="both" xstyle={styles.page}>- <XDSCard padding={8} width={400}>+ <XDSCard padding={8} width="100%" maxWidth={400}><XDSVStack gap={4} hAlign="stretch">{/* ── Step 1: Email entry ── */}{step === 'email' && (diff --git a/packages/cli/templates/pages/login/page.tsx b/packages/cli/templates/pages/login/page.tsxindex 2b686cc913..c10fd0e3e3 100644--- a/packages/cli/templates/pages/login/page.tsx+++ b/packages/cli/templates/pages/login/page.tsx@@ -13,13 +13,20 @@ import {XDSCard} from '@xds/core/Card';import {XDSIcon} from '@xds/core/Icon';import {XDSBanner} from '@xds/core/Banner';import {CubeIcon} from '@heroicons/react/24/outline';-import {colorVars} from '@xds/core/theme/tokens.stylex';+import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';// Standalone auth page paints its own body background (no host shell).const styles = stylex.create({page: {minHeight: '100%',backgroundColor: colorVars['--color-background-body'],+ padding: spacingVars['--spacing-6'],+ },+ // Cap the column at 400px but let it shrink to fit narrow screens (XDSStack+ // has no maxWidth prop, so it's set here).+ content: {+ width: '100%',+ maxWidth: 400,},});@@ -41,7 +48,7 @@ export default function LoginPage() {return (<XDSCenter axis="both" xstyle={styles.page}>- <XDSVStack gap={4} hAlign="center">+ <XDSVStack gap={4} hAlign="center" xstyle={styles.content}>{/* Logo */}<XDSVStack gap={2} hAlign="center"><XDSIcon icon={CubeIcon} size="lg" />@@ -51,7 +58,7 @@ export default function LoginPage() {</XDSVStack>{/* Card */}- <XDSCard padding={8} width={400}>+ <XDSCard padding={8} width="100%"><XDSVStack gap={4} hAlign="stretch"><XDSVStack gap={1} hAlign="center"><XDSHeading level={2}>Sign in</XDSHeading>