An open source design system that's fully customizable and agent ready
TypeScript
fix(templates): improve two-column contact form rubric score (#1622)
sheryl3058a93a0546
diff --git a/packages/cli/templates/pages/form-two-column/page.tsx b/packages/cli/templates/pages/form-two-column/page.tsxindex aa5c8cb22e..4317a41b8b 100644--- a/packages/cli/templates/pages/form-two-column/page.tsx+++ b/packages/cli/templates/pages/form-two-column/page.tsx@@ -2,7 +2,11 @@import {useState} from 'react';import * as stylex from '@stylexjs/stylex';-import {XDSVStack} from '@xds/core/Layout';+import {XDSVStack, XDSHStack} from '@xds/core/Layout';+import {XDSCenter} from '@xds/core/Center';+import {XDSSection} from '@xds/core/Section';+import {XDSGrid} from '@xds/core/Grid';+import {XDSAspectRatio} from '@xds/core/AspectRatio';import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';import {XDSTextInput} from '@xds/core/TextInput';@@ -12,14 +16,11 @@ import {XDSLink} from '@xds/core/Link';import {XDSDivider} from '@xds/core/Divider';import {XDSCard} from '@xds/core/Card';import {XDSSelector} from '@xds/core/Selector';-import {- colorVars,- spacingVars,- radiusVars,-} from '@xds/core/theme/tokens.stylex';+import {colorVars} from '@xds/core/theme/tokens.stylex';+// illustration-horizontal-1 from xds_oss asset setconst ILLUSTRATION_URL =- 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=800&q=80';+ 'https://lookaside.facebook.com/assets/xds_oss/illustration-horizontal-1.png';// ─────────────────────────────────────────────────────────────// Constants@@ -57,92 +58,15 @@ const CONTACT_COLUMNS = [const styles = stylex.create({page: {backgroundColor: colorVars['--color-background-surface'],- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- minHeight: '100svh',- padding: 48,- },- inner: {- maxWidth: 1100,- width: '100%',- display: 'flex',- flexDirection: 'column',- gap: 56,- },- topGrid: {- display: 'grid',- gridTemplateColumns: '1fr 1fr',- gap: 80,- alignItems: 'center',- },- headline: {- fontSize: 48,- fontWeight: 700,- lineHeight: 1.05,- letterSpacing: '-0.03em',- margin: 0,},imagePlaceholder: {- backgroundColor: colorVars['--color-background-surface'],- borderRadius: radiusVars['--radius-container'],- overflow: 'hidden',- alignSelf: 'flex-start',width: '85%',- aspectRatio: '4 / 3',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- },- inlineGrid: {- display: 'grid',- gridTemplateColumns: '1fr 1fr',- gap: 12,- },- footerGrid: {- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr',- gap: 32,- paddingTop: 32,- textAlign: 'center',- },- footerLabel: {- textTransform: 'uppercase',- letterSpacing: '0.08em',- },- tokenWrap: {- display: 'flex',- flexWrap: 'wrap',- gap: spacingVars['--spacing-2'],},fullWidth: {width: '100%',},});-const mobileStyles = stylex.create({- page: {- padding: 20,- alignItems: 'flex-start',- },- topGrid: {- gridTemplateColumns: '1fr',- gap: 32,- },- image: {- width: '100%',- },- footerGrid: {- gridTemplateColumns: '1fr',- textAlign: 'left',- },- inlineGrid: {- gridTemplateColumns: '1fr',- },-});--const MOBILE = '@media (max-width: 767px)' as const;-// ─────────────────────────────────────────────────────────────// Page// ─────────────────────────────────────────────────────────────@@ -178,151 +102,155 @@ export default function FormTwoColumnPage() {const handleSubmit = () => setSubmitted(true);return (- <div {...stylex.props(styles.page)}>- <div {...stylex.props(styles.inner)}>- {/* ── Top: two-column ── */}- <div {...stylex.props(styles.topGrid)}>- {/* Left: headline + description + illustration */}- <XDSVStack gap={6}>- <XDSVStack gap={3}>- <div {...stylex.props(styles.headline)}>- Let's work together- </div>- <XDSText type="body" color="secondary">- Tell us what you're working on and we'll help you- figure out the best path forward.- </XDSText>+ <XDSCenter height="100svh" xstyle={styles.page}>+ <XDSSection+ maxWidth={1100}+ width="100%"+ padding={10}+ variant="transparent">+ <XDSVStack gap={10}>+ {/* ── Top: two-column ── */}+ <XDSGrid columns={2} align="center" gap={10}>+ {/* Left: headline + description + illustration */}+ <XDSVStack gap={6}>+ <XDSVStack gap={3}>+ <XDSText type="display-1" as="h1">+ Let's work together+ </XDSText>+ <XDSText type="body" color="secondary">+ Tell us what you're working on and we'll help you+ figure out the best path forward.+ </XDSText>+ </XDSVStack>+ <XDSAspectRatio ratio={4 / 3} xstyle={styles.imagePlaceholder}>+ <img src={ILLUSTRATION_URL} alt="Illustration" />+ </XDSAspectRatio></XDSVStack>- <div {...stylex.props(styles.imagePlaceholder)}>- <img- src={ILLUSTRATION_URL}- alt="Illustration"- style={{width: '100%', height: '100%', objectFit: 'contain'}}- />- </div>- </XDSVStack>- {/* Right: form on a card */}- <XDSCard padding={8}>- <XDSVStack gap={4}>- <XDSText type="label">Your details</XDSText>- <XDSTextInput- label="Full name"- isLabelHidden- placeholder="Full name*"- value={fullName}- onChange={setFullName}- status={- errors.fullName- ? {type: 'error', message: errors.fullName}- : undefined- }- />- <div {...stylex.props(styles.inlineGrid)}>+ {/* Right: form on a card */}+ <XDSCard padding={8}>+ <XDSVStack gap={4}>+ <XDSText type="label">Your details</XDSText><XDSTextInput- label="Email"+ label="Full name"isLabelHidden- placeholder="Email*"- value={email}- onChange={setEmail}+ placeholder="Full name*"+ value={fullName}+ onChange={setFullName}status={- errors.email- ? {type: 'error', message: errors.email}+ errors.fullName+ ? {type: 'error', message: errors.fullName}: undefined}/>- <XDSTextInput- label="Company name"- isLabelHidden- placeholder="Company name"- value={company}- onChange={setCompany}+ <XDSGrid columns={2} gap={3}>+ <XDSTextInput+ label="Email"+ isLabelHidden+ placeholder="Email*"+ value={email}+ onChange={setEmail}+ status={+ errors.email+ ? {type: 'error', message: errors.email}+ : undefined+ }+ />+ <XDSTextInput+ label="Company name"+ isLabelHidden+ placeholder="Company name"+ value={company}+ onChange={setCompany}+ />+ </XDSGrid>+ <XDSGrid columns={2} gap={3}>+ <XDSTextInput+ label="Job title"+ isLabelHidden+ placeholder="Job title"+ value={jobTitle}+ onChange={setJobTitle}+ />+ <XDSTextInput+ label="Phone number"+ isLabelHidden+ placeholder="Phone number"+ value={phone}+ onChange={setPhone}+ />+ </XDSGrid>++ <XDSVStack gap={2}>+ <XDSText type="label">+ What are you reaching out about?+ </XDSText>+ <XDSHStack gap={2} wrap="wrap">+ {INQUIRY_REASONS.map(reason => (+ <XDSToken+ key={reason}+ label={reason}+ color={inquiryReason === reason ? 'blue' : 'default'}+ onClick={() =>+ setInquiryReason(prev =>+ prev === reason ? '' : reason,+ )+ }+ />+ ))}+ </XDSHStack>+ </XDSVStack>+ <XDSSelector+ label="Budget range"+ options={BUDGET_OPTIONS}+ value={budget}+ onChange={setBudget}+ placeholder="Select a budget range..."/>- </div>- <div {...stylex.props(styles.inlineGrid)}>- <XDSTextInput- label="Job title"+ <XDSTextArea+ label="Project details"isLabelHidden- placeholder="Job title"- value={jobTitle}- onChange={setJobTitle}+ placeholder="Project details*"+ value={details}+ onChange={setDetails}+ status={+ errors.details+ ? {type: 'error', message: errors.details}+ : undefined+ }/>- <XDSTextInput- label="Phone number"- isLabelHidden- placeholder="Phone number"- value={phone}- onChange={setPhone}+ <XDSButton+ label="Let's connect"+ variant="primary"+ xstyle={styles.fullWidth}+ onClick={handleSubmit}/>- </div>-- <XDSVStack gap={2}>- <XDSText type="label">What are you reaching out about?</XDSText>- <div {...stylex.props(styles.tokenWrap)}>- {INQUIRY_REASONS.map(reason => (- <XDSToken- key={reason}- label={reason}- color={inquiryReason === reason ? 'blue' : 'default'}- onClick={() =>- setInquiryReason(prev =>- prev === reason ? '' : reason,- )- }- />- ))}- </div></XDSVStack>- <XDSSelector- label="Budget range"- options={BUDGET_OPTIONS}- value={budget}- onChange={setBudget}- placeholder="Select a budget range..."- />- <XDSTextArea- label="Project details"- isLabelHidden- placeholder="Project details*"- value={details}- onChange={setDetails}- status={- errors.details- ? {type: 'error', message: errors.details}- : undefined- }- />- <XDSButton- label="Let's connect"- variant="primary"- xstyle={styles.fullWidth}- onClick={handleSubmit}- />- </XDSVStack>- </XDSCard>- </div>+ </XDSCard>+ </XDSGrid>- {/* ── Bottom: contact strip ── */}- <div>- <XDSDivider />- <div {...stylex.props(styles.footerGrid)}>- {CONTACT_COLUMNS.map(col => (- <XDSVStack key={col.label} gap={1} hAlign="center">- <XDSText type="supporting" color="secondary">- <span {...stylex.props(styles.footerLabel)}>{col.label}</span>- </XDSText>- <XDSLink- label={col.email}- href={`mailto:${col.email}`}- type="body"- size="sm">- {col.email}- </XDSLink>- </XDSVStack>- ))}- </div>- </div>- </div>- </div>+ {/* ── Bottom: contact strip ── */}+ <XDSVStack gap={6}>+ <XDSDivider />+ <XDSGrid columns={3} gap={6}>+ {CONTACT_COLUMNS.map(col => (+ <XDSVStack key={col.label} gap={1} hAlign="center">+ <XDSText type="supporting" color="secondary">+ {col.label}+ </XDSText>+ <XDSLink+ label={col.email}+ href={`mailto:${col.email}`}+ type="body"+ size="sm">+ {col.email}+ </XDSLink>+ </XDSVStack>+ ))}+ </XDSGrid>+ </XDSVStack>+ </XDSVStack>+ </XDSSection>+ </XDSCenter>);}