Skip to content

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

TypeScript

refactor(templates): upgrade all three settings templates to Grade A (#1488)

rubyycheung94b2d247558b
diff --git a/packages/cli/templates/pages/settings-dialog/page.tsx b/packages/cli/templates/pages/settings-dialog/page.tsx
index efdacb35bf..ff3f4c6396 100644
--- a/packages/cli/templates/pages/settings-dialog/page.tsx
+++ b/packages/cli/templates/pages/settings-dialog/page.tsx
@@ -1,29 +1,29 @@
'use client';
-import {useState} from 'react';
+import React, {useState} from 'react';
import * as stylex from '@stylexjs/stylex';
+import {XDSAppShell} from '@xds/core/AppShell';
import {
XDSVStack,
XDSHStack,
+ XDSStackItem,
XDSLayout,
XDSLayoutPanel,
XDSLayoutContent,
} from '@xds/core/Layout';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSButton} from '@xds/core/Button';
-import {XDSDialog} from '@xds/core/Dialog';
+import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSDivider} from '@xds/core/Divider';
import {XDSSelector} from '@xds/core/Selector';
-import {XDSTextInput} from '@xds/core/TextInput';
-import {XDSSection} from '@xds/core/Section';
import {XDSCard} from '@xds/core/Card';
import {XDSSwitch} from '@xds/core/Switch';
import {XDSLink} from '@xds/core/Link';
import {XDSTabList, XDSTab} from '@xds/core/TabList';
import {XDSBadge} from '@xds/core/Badge';
import {XDSIcon} from '@xds/core/Icon';
-import {colorVars} from '@xds/core/theme/tokens.stylex';
+import {XDSCenter} from '@xds/core/Center';
import {
UserIcon,
LockClosedIcon,
@@ -31,7 +31,6 @@ import {
ShieldCheckIcon,
ComputerDesktopIcon,
WrenchScrewdriverIcon,
- XMarkIcon,
BellIcon,
DocumentTextIcon,
CreditCardIcon,
@@ -40,9 +39,52 @@ import {
ShareIcon,
} from '@heroicons/react/24/outline';
-// ---------------------------------------------------------------------------
-// Data
-// ---------------------------------------------------------------------------
+const styles = stylex.create({
+ iconBox: {
+ borderRadius: 12,
+ backgroundColor: 'var(--xds-color-background-surface, #fff)',
+ flexShrink: 0,
+ },
+ rowPadding: {
+ paddingBlock: 16,
+ },
+ cardContentPadding: {
+ paddingInline: 16,
+ },
+ headerPadding: {
+ paddingInline: 8,
+ paddingBlock: 8,
+ position: 'sticky',
+ top: 0,
+ backgroundColor: 'var(--xds-color-background-surface, #fff)',
+ zIndex: 1,
+ },
+ contentHPadding: {
+ paddingInline: 24,
+ paddingBlockEnd: 24,
+ maxWidth: 680,
+ },
+ sideNavPadding: {
+ paddingBlock: 16,
+ paddingInline: 12,
+ },
+ sectionHeading: {
+ paddingBlockEnd: 8,
+ },
+ sideNavHeading: {
+ marginInline: 16,
+ },
+ dialogHeight: {
+ height: '85vh',
+ minHeight: '85vh',
+ },
+ layoutFill: {
+ flex: '1 1 0px',
+ },
+ panelFull: {
+ height: '100%',
+ },
+});
const NAV_ITEMS = [
{label: 'Personal information', icon: UserIcon},
@@ -55,11 +97,11 @@ const NAV_ITEMS = [
{label: 'Travel for work', icon: BriefcaseIcon},
];
-const LOGIN_ROWS: {label: string; value: string; action: string}[] = [
+const LOGIN_ROWS = [
{label: 'Password', value: 'Not created', action: 'Create'},
];
-const SOCIAL_ROWS: {label: string; value: string; action: string}[] = [
+const SOCIAL_ROWS = [
{label: 'Google', value: 'Connected', action: 'Disconnect'},
];
@@ -108,10 +150,6 @@ const TIMEZONES = [
{label: '(GMT+01:00) London', value: 'GMT+1'},
];
-// ---------------------------------------------------------------------------
-// Expandable row
-// ---------------------------------------------------------------------------
-
interface ExpandableRowProps {
label: string;
value: string;
@@ -134,28 +172,26 @@ function ExpandableRow({
return (
<>
{isExpanded ? (
- <div {...stylex.props(styles.rowPadding)}>
- <div {...stylex.props(styles.marginBottom12)}>
- <XDSText type="body" weight="semibold" display="block">
- {label}
- </XDSText>
- </div>
- <div {...stylex.props(styles.marginBottom16)}>{children}</div>
+ <XDSVStack gap={4} xstyle={styles.rowPadding}>
+ <XDSText type="body" weight="semibold" display="block">
+ {label}
+ </XDSText>
+ {children}
<XDSHStack gap={2}>
<XDSButton label="Save" variant="primary" onClick={onSave} />
<XDSButton label="Cancel" variant="ghost" onClick={onCancel} />
</XDSHStack>
- </div>
+ </XDSVStack>
) : (
<XDSHStack hAlign="between" vAlign="start" xstyle={styles.rowPadding}>
- <div>
+ <XDSVStack gap={0}>
<XDSText type="body" weight="semibold" display="block">
{label}
</XDSText>
<XDSText type="supporting" color="secondary" display="block">
{value}
</XDSText>
- </div>
+ </XDSVStack>
<XDSLink
label="Edit"
href="#"
@@ -184,14 +220,14 @@ function InfoRowItem({
return (
<>
<XDSHStack hAlign="between" vAlign="start" xstyle={styles.rowPadding}>
- <div>
+ <XDSVStack gap={0}>
<XDSText type="body" weight="semibold" display="block">
{label}
</XDSText>
<XDSText type="supporting" color="secondary" display="block">
{value}
</XDSText>
- </div>
+ </XDSVStack>
{action && (
<XDSLink label={action} href="#">
{action}
@@ -203,111 +239,11 @@ function InfoRowItem({
);
}
-// ---------------------------------------------------------------------------
-// Styles
-// ---------------------------------------------------------------------------
-
-const styles = stylex.create({
- pageBg: {backgroundColor: colorVars['--color-background-body']},
- cardBg: {backgroundColor: colorVars['--color-background-card']},
- noBorder: {borderWidth: 0},
- pageCenter: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- position: 'fixed',
- inset: 0,
- },
- dialogInner: {
- height: '100%',
- minHeight: 'calc(85vh - 2px)',
- maxHeight: 'calc(85vh - 2px)',
- position: 'relative',
- },
- closeButton: {
- position: 'absolute',
- top: 12,
- right: 12,
- zIndex: 1,
- },
- navHeadingPadding: {
- paddingLeft: 16,
- paddingRight: 16,
- },
- contentPadding: {
- padding: '16px 32px',
- maxWidth: 680,
- },
- rowPadding: {
- padding: '16px 0',
- },
- rowPaddingTop: {
- paddingTop: 16,
- paddingBottom: 0,
- },
- rowPaddingBottom: {
- paddingTop: 0,
- paddingBottom: 16,
- },
- marginBottom12: {
- marginBottom: 12,
- },
- marginBottom16: {
- marginBottom: 16,
- },
- marginTop8: {
- marginTop: 8,
- },
- marginTop16: {
- marginTop: 16,
- },
- cardMarginTop: {
- marginTop: 16,
- },
- tabOffset: {
- marginLeft: -12,
- overflow: 'hidden',
- },
- iconBox: {
- width: 48,
- height: 48,
- borderRadius: 12,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- },
- iconBoxMuted: {
- backgroundColor: colorVars['--color-background-muted'],
- },
- iconBoxSurface: {
- backgroundColor: colorVars['--color-background-surface'],
- },
- flex1: {
- flex: 1,
- },
- flexShrink0MarginTop2: {
- flexShrink: 0,
- marginTop: 2,
- },
- paddingTop16: {
- paddingTop: 16,
- },
-});
-
-// ---------------------------------------------------------------------------
-// Component
-// ---------------------------------------------------------------------------
-
export default function SettingsDialogTemplate() {
const [isOpen, setIsOpen] = useState(false);
const [activeNav, setActiveNav] = useState('Login & security');
const [expandedRow, setExpandedRow] = useState<string | null>(null);
- const [firstName, setFirstName] = useState('Alex');
- const [lastName, setLastName] = useState('Johnson');
- const [email, setEmail] = useState('[email protected]');
- const [phone, setPhone] = useState('+1 (416) 555-0123');
const [language, setLanguage] = useState('en-CA');
const [currency, setCurrency] = useState('CAD');
const [timezone, setTimezone] = useState('ET');
@@ -325,273 +261,245 @@ export default function SettingsDialogTemplate() {
const handleSave = () => setExpandedRow(null);
return (
- <div {...stylex.props(styles.pageBg, styles.pageCenter)}>
- <XDSButton
- label="Open settings"
- variant="primary"
- onClick={() => setIsOpen(true)}
- />
+ <XDSAppShell>
+ <XDSCenter height="80vh">
+ <XDSButton
+ label="Open settings"
+ variant="primary"
+ onClick={() => setIsOpen(true)}
+ />
+ </XDSCenter>
+
<XDSDialog
isOpen={isOpen}
onOpenChange={open => setIsOpen(open)}
width={900}
maxHeight="85vh"
padding={0}
- purpose="form">
- <div {...stylex.props(styles.dialogInner)}>
- {/* Close button — top right, no header bar */}
- <div {...stylex.props(styles.closeButton)}>
- <XDSButton
- label="Close"
- icon={<XMarkIcon width={20} height={20} />}
- variant="ghost"
- onClick={() => setIsOpen(false)}
- isIconOnly
- />
- </div>
-
- <XDSLayout
- height="fill"
- padding={0}
- start={
- <XDSLayoutPanel
- width={280}
- hasDivider
- role="navigation"
- padding={3}
- xstyle={styles.cardBg}>
- <XDSVStack gap={4}>
- <div {...stylex.props(styles.navHeadingPadding)}>
- <XDSHeading level={2}>Account settings</XDSHeading>
- </div>
- <XDSList density="spacious">
- {NAV_ITEMS.map(item => (
- <XDSListItem
- key={item.label}
- label={item.label}
- startContent={<item.icon width={20} height={20} />}
- isSelected={activeNav === item.label}
- onClick={() => {
- setActiveNav(item.label);
- setExpandedRow(null);
- }}
- />
- ))}
- </XDSList>
- <XDSDivider />
- <XDSList density="spacious">
+ purpose="form"
+ xstyle={styles.dialogHeight}>
+ <XDSLayout
+ height="fill"
+ xstyle={styles.layoutFill}
+ start={
+ <XDSLayoutPanel
+ width={280}
+ hasDivider
+ role="navigation"
+ padding={0}
+ xstyle={styles.panelFull}>
+ <XDSVStack gap={4} xstyle={styles.sideNavPadding}>
+ <XDSHeading level={2} xstyle={styles.sideNavHeading}>Account settings</XDSHeading>
+ <XDSList density="spacious">
+ {NAV_ITEMS.map(item => (
<XDSListItem
- label="Professional hosting tools"
- startContent={
- <WrenchScrewdriverIcon width={20} height={20} />
- }
- onClick={() => {}}
+ key={item.label}
+ label={item.label}
+ startContent={<XDSIcon icon={item.icon} />}
+ isSelected={activeNav === item.label}
+ onClick={() => {
+ setActiveNav(item.label);
+ setExpandedRow(null);
+ }}
/>
- </XDSList>
- </XDSVStack>
- </XDSLayoutPanel>
- }
- content={
- <XDSLayoutContent>
- <div {...stylex.props(styles.contentPadding)}>
- {activeNav === 'Personal information' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Personal info</XDSHeading>
- <XDSVStack gap={0}>
- <InfoRowItem
- label="Legal name"
- value="Alex Johnson"
- action="Edit"
- />
- <InfoRowItem
- label="Preferred first name"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Email address"
- value="a***[email protected]"
- action="Edit"
- />
- <InfoRowItem
- label="Phone number"
- value="+1 ***-***-0123"
- action="Edit"
- />
- <InfoRowItem
- label="Identity verification"
- value="Verified"
- action=""
- />
- <InfoRowItem
- label="Residential address"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Mailing address"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Emergency contact"
- value="Provided"
- action="Edit"
- />
- </XDSVStack>
-
- <XDSCard padding={4} xstyle={styles.cardMarginTop}>
- <XDSVStack gap={0}>
- <div {...stylex.props(styles.rowPaddingBottom)}>
- <XDSHStack gap={3} vAlign="start">
- <div
- {...stylex.props(
- styles.iconBox,
- styles.iconBoxMuted,
- )}>
- <XDSIcon icon={LockClosedIcon} size="lg" />
- </div>
- <XDSVStack gap={0}>
- <XDSText
- type="body"
- weight="semibold"
- display="block">
- Why isn&apos;t my info shown here?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- We&apos;re hiding some account details to
- protect your identity.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- <XDSDivider />
- <div {...stylex.props(styles.rowPadding)}>
- <XDSHStack gap={3} vAlign="start">
- <div
- {...stylex.props(
- styles.iconBox,
- styles.iconBoxMuted,
- )}>
- <XDSIcon icon={PencilSquareIcon} size="lg" />
- </div>
- <XDSVStack gap={0}>
- <XDSText
- type="body"
- weight="semibold"
- display="block">
- Which details can be edited?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- Contact info and personal details can be
- edited. If this info was used to verify your
- identity, you&apos;ll need to get verified
- again the next time you book—or to continue
- hosting.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- <XDSDivider />
- <div {...stylex.props(styles.rowPaddingTop)}>
- <XDSHStack gap={3} vAlign="start">
- <div
- {...stylex.props(
- styles.iconBox,
- styles.iconBoxMuted,
- )}>
- <XDSIcon icon={ShareIcon} size="lg" />
- </div>
- <XDSVStack gap={0}>
- <XDSText
- type="body"
- weight="semibold"
- display="block">
- What info is shared with others?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- We only release contact information after a
- reservation is confirmed.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- </XDSVStack>
- </XDSCard>
+ ))}
+ </XDSList>
+ <XDSDivider />
+ <XDSList density="spacious">
+ <XDSListItem
+ label="Professional hosting tools"
+ startContent={<XDSIcon icon={WrenchScrewdriverIcon} />}
+ onClick={() => {}}
+ />
+ </XDSList>
+ </XDSVStack>
+ </XDSLayoutPanel>
+ }
+ content={
+ <XDSLayoutContent isScrollable padding={0}>
+ <XDSVStack xstyle={styles.headerPadding}>
+ <XDSDialogHeader
+ title={activeNav === 'Personal information' ? 'Personal info' : activeNav}
+ onOpenChange={open => setIsOpen(open)}
+ hasDivider={false}
+ />
+ </XDSVStack>
+ <XDSVStack gap={0} xstyle={styles.contentHPadding}>
+ {activeNav === 'Personal information' && (
+ <XDSVStack gap={6}>
+ <XDSVStack gap={0}>
+ <InfoRowItem
+ label="Legal name"
+ value="Alex Johnson"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Preferred first name"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Email address"
+ value="a***[email protected]"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Phone number"
+ value="+1 ***-***-0123"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Identity verification"
+ value="Verified"
+ action=""
+ />
+ <InfoRowItem
+ label="Residential address"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Mailing address"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Emergency contact"
+ value="Provided"
+ action="Edit"
+ />
</XDSVStack>
- )}
- {activeNav === 'Login & security' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Login &amp; security</XDSHeading>
-
- <div {...stylex.props(styles.tabOffset)}>
- <XDSTabList
- value={activeTab}
- onChange={setActiveTab}
- hasDivider>
- <XDSTab value="login" label="Login" />
- <XDSTab value="shared" label="Shared access" />
- </XDSTabList>
- </div>
-
- {activeTab === 'login' && (
- <XDSVStack gap={8}>
- {/* Login */}
+ <XDSCard padding={0}>
+ <XDSVStack gap={0} xstyle={styles.cardContentPadding}>
+ <XDSHStack
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={LockClosedIcon} />
+ </XDSCenter>
<XDSVStack gap={0}>
- <XDSHeading level={3}>Login</XDSHeading>
- <div {...stylex.props(styles.marginTop8)}>
- <XDSDivider />
- </div>
- {LOGIN_ROWS.map(row => (
- <InfoRowItem key={row.label} {...row} />
- ))}
+ <XDSText
+ type="body"
+ weight="semibold"
+ display="block">
+ Why isn&apos;t my info shown here?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ We&apos;re hiding some account details to
+ protect your identity.
+ </XDSText>
</XDSVStack>
-
- {/* Social accounts */}
+ </XDSHStack>
+ <XDSDivider />
+ <XDSHStack
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={PencilSquareIcon} />
+ </XDSCenter>
<XDSVStack gap={0}>
- <XDSHeading level={3}>Social accounts</XDSHeading>
- <div {...stylex.props(styles.marginTop8)}>
- <XDSDivider />
- </div>
- {SOCIAL_ROWS.map(row => (
- <InfoRowItem key={row.label} {...row} />
- ))}
+ <XDSText
+ type="body"
+ weight="semibold"
+ display="block">
+ Which details can be edited?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ Contact info and personal details can be edited.
+ If this info was used to verify your identity,
+ you&apos;ll need to get verified again the next
+ time you book—or to continue hosting.
+ </XDSText>
</XDSVStack>
-
- {/* Device history */}
+ </XDSHStack>
+ <XDSDivider />
+ <XDSHStack
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={ShareIcon} />
+ </XDSCenter>
<XDSVStack gap={0}>
- <XDSHeading level={3}>Device history</XDSHeading>
- <div {...stylex.props(styles.marginTop8)}>
- <XDSDivider />
- </div>
- {DEVICE_ROWS.map((device, i) => (
- <div key={i}>
- <XDSHStack
- hAlign="between"
- vAlign="start"
- gap={3}
- xstyle={styles.rowPadding}>
- <div
- {...stylex.props(
- styles.flexShrink0MarginTop2,
- )}>
- <XDSIcon
- icon={ComputerDesktopIcon}
- size="lg"
- />
- </div>
- <div {...stylex.props(styles.flex1)}>
- <XDSHStack vAlign="center" gap={2}>
+ <XDSText
+ type="body"
+ weight="semibold"
+ display="block">
+ What info is shared with others?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ We only release contact information after a
+ reservation is confirmed.
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ </XDSVStack>
+ </XDSCard>
+ </XDSVStack>
+ )}
+
+ {activeNav === 'Login & security' && (
+ <XDSVStack gap={6}>
+ <XDSTabList
+ value={activeTab}
+ onChange={setActiveTab}
+ hasDivider>
+ <XDSTab value="login" label="Login" />
+ <XDSTab value="shared" label="Shared access" />
+ </XDSTabList>
+
+ {activeTab === 'login' && (
+ <XDSVStack gap={8}>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3} xstyle={styles.sectionHeading}>Login</XDSHeading>
+ <XDSDivider />
+ {LOGIN_ROWS.map(row => (
+ <InfoRowItem key={row.label} {...row} />
+ ))}
+ </XDSVStack>
+
+ <XDSVStack gap={0}>
+ <XDSHeading level={3} xstyle={styles.sectionHeading}>Social accounts</XDSHeading>
+ <XDSDivider />
+ {SOCIAL_ROWS.map(row => (
+ <InfoRowItem key={row.label} {...row} />
+ ))}
+ </XDSVStack>
+
+ <XDSVStack gap={0}>
+ <XDSHeading level={3} xstyle={styles.sectionHeading}>Device history</XDSHeading>
+ <XDSDivider />
+ {DEVICE_ROWS.map((device, i) => (
+ <React.Fragment key={i}>
+ <XDSHStack
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSIcon icon={ComputerDesktopIcon} />
+ <XDSStackItem size="fill">
+ <XDSVStack gap={0}>
+ <XDSHStack gap={2} vAlign="center">
<XDSText type="body" weight="semibold">
{device.label}
</XDSText>
@@ -601,338 +509,310 @@ export default function SettingsDialogTemplate() {
</XDSHStack>
<XDSText
type="supporting"
- color="secondary">
+ color="secondary"
+ display="block">
{device.location}
</XDSText>
- </div>
- {device.action && (
- <XDSLink label={device.action} href="#">
- {device.action}
- </XDSLink>
- )}
- </XDSHStack>
- <XDSDivider />
- </div>
- ))}
- </XDSVStack>
-
- {/* Account */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Account</XDSHeading>
- <div {...stylex.props(styles.marginTop8)}>
+ </XDSVStack>
+ </XDSStackItem>
+ {device.action && (
+ <XDSLink label={device.action} href="#">
+ {device.action}
+ </XDSLink>
+ )}
+ </XDSHStack>
<XDSDivider />
- </div>
- <XDSHStack
- hAlign="between"
- vAlign="start"
- xstyle={styles.rowPadding}>
- <div>
- <XDSText
- type="body"
- weight="semibold"
- display="block">
- Deactivate your account
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- This action cannot be undone
- </XDSText>
- </div>
- <XDSLink label="Deactivate" href="#">
- Deactivate
- </XDSLink>
- </XDSHStack>
- <XDSDivider />
- </XDSVStack>
+ </React.Fragment>
+ ))}
</XDSVStack>
- )}
- {activeTab === 'shared' && (
- <XDSVStack gap={8}>
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Shared access</XDSHeading>
- <div {...stylex.props(styles.marginTop8)}>
- <XDSDivider />
- </div>
- <div {...stylex.props(styles.paddingTop16)}>
- <XDSText type="body" color="secondary">
- Review each request carefully before approving
- access. We&apos;ll email your employee or
- co-worker a 4-digit code that lets them log into
- your account with their trusted device.
+ <XDSVStack gap={0}>
+ <XDSHeading level={3} xstyle={styles.sectionHeading}>Account</XDSHeading>
+ <XDSDivider />
+ <XDSHStack
+ hAlign="between"
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSVStack gap={0}>
+ <XDSText
+ type="body"
+ weight="semibold"
+ display="block">
+ Deactivate your account
</XDSText>
- </div>
- </XDSVStack>
-
- <XDSCard>
- <XDSSection variant="wash">
- <XDSHStack gap={4} vAlign="start">
- <div
- {...stylex.props(
- styles.iconBox,
- styles.iconBoxSurface,
- )}>
- <XDSIcon icon={LockClosedIcon} size="lg" />
- </div>
- <XDSVStack gap={1}>
- <XDSText type="body" weight="bold">
- Adding devices from people you trust
- </XDSText>
- <XDSText type="body" color="secondary">
- When you approve a request, you grant
- someone full access to your account.
- They&apos;ll be able to change reservations
- and send messages on your behalf.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </XDSSection>
- </XDSCard>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ This action cannot be undone
+ </XDSText>
+ </XDSVStack>
+ <XDSLink label="Deactivate" href="#">
+ Deactivate
+ </XDSLink>
+ </XDSHStack>
+ <XDSDivider />
</XDSVStack>
- )}
- </XDSVStack>
- )}
-
- {activeNav === 'Languages & currency' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>
- Languages &amp; currency
- </XDSHeading>
- <XDSVStack gap={0}>
- <ExpandableRow
- label="Preferred language"
- value={
- LANGUAGES.find(l => l.value === language)?.label ??
- language
- }
- isExpanded={expandedRow === 'language'}
- onEdit={() => handleEdit('language')}
- onCancel={handleCancel}
- onSave={handleSave}>
- <XDSSelector
- label="Language"
- isLabelHidden
- size="lg"
- value={language}
- onChange={setLanguage}
- options={LANGUAGES}
- />
- </ExpandableRow>
- <ExpandableRow
- label="Preferred currency"
- value={
- CURRENCIES.find(c => c.value === currency)?.label ??
- currency
- }
- isExpanded={expandedRow === 'currency'}
- onEdit={() => handleEdit('currency')}
- onCancel={handleCancel}
- onSave={handleSave}>
- <XDSSelector
- label="Currency"
- isLabelHidden
- size="lg"
- value={currency}
- onChange={setCurrency}
- options={CURRENCIES}
- />
- </ExpandableRow>
- <ExpandableRow
- label="Time zone"
- value={
- TIMEZONES.find(t => t.value === timezone)?.label ??
- timezone
- }
- isExpanded={expandedRow === 'timezone'}
- onEdit={() => handleEdit('timezone')}
- onCancel={handleCancel}
- onSave={handleSave}>
- <XDSSelector
- label="Time zone"
- isLabelHidden
- size="lg"
- value={timezone}
- onChange={setTimezone}
- options={TIMEZONES}
- />
- </ExpandableRow>
</XDSVStack>
- </XDSVStack>
- )}
-
- {activeNav === 'Privacy' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Privacy</XDSHeading>
+ )}
+ {activeTab === 'shared' && (
<XDSVStack gap={8}>
- {/* Messages */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Messages</XDSHeading>
- <div {...stylex.props(styles.marginTop16)}>
- <XDSSwitch
- label="Show people when I've read their messages."
- value={readReceipts}
- onChange={setReadReceipts}
- labelPosition="start"
- labelSpacing="spread"
- />
- </div>
- <div {...stylex.props(styles.rowPadding)}>
- <XDSHStack hAlign="between" vAlign="center">
- <XDSText type="body" weight="semibold">
- Blocked people
- </XDSText>
- <XDSLink label="View" href="#">
- View
- </XDSLink>
- </XDSHStack>
- </div>
+ <XDSVStack gap={2}>
+ <XDSHeading level={3} xstyle={styles.sectionHeading}>Shared access</XDSHeading>
<XDSDivider />
+ <XDSText type="body" color="secondary">
+ Review each request carefully before approving
+ access. We&apos;ll email your employee or co-worker
+ a 4-digit code that lets them log into your account
+ with their trusted device.
+ </XDSText>
</XDSVStack>
- {/* Listings */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Listings</XDSHeading>
- <div {...stylex.props(styles.marginTop16)}>
- <XDSSwitch
- label="Include my listing(s) in search engines"
- description="Turning this on means search engines, like Google, will display your listing page(s) in search results."
- value={searchEngines}
- onChange={setSearchEngines}
- labelPosition="start"
- labelSpacing="spread"
- />
- </div>
- <div {...stylex.props(styles.marginTop8)}>
- <XDSDivider />
- </div>
+ <XDSCard variant="muted">
+ <XDSHStack gap={4} vAlign="start">
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={LockClosedIcon} />
+ </XDSCenter>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Adding devices from people you trust
+ </XDSText>
+ <XDSText type="body" color="secondary">
+ When you approve a request, you grant someone
+ full access to your account. They&apos;ll be
+ able to change reservations and send messages on
+ your behalf.
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ </XDSCard>
+ </XDSVStack>
+ )}
+ </XDSVStack>
+ )}
+
+ {activeNav === 'Languages & currency' && (
+ <XDSVStack gap={6}>
+ <XDSVStack gap={0}>
+ <ExpandableRow
+ label="Preferred language"
+ value={
+ LANGUAGES.find(l => l.value === language)?.label ??
+ language
+ }
+ isExpanded={expandedRow === 'language'}
+ onEdit={() => handleEdit('language')}
+ onCancel={handleCancel}
+ onSave={handleSave}>
+ <XDSSelector
+ label="Language"
+ isLabelHidden
+ size="lg"
+ value={language}
+ onChange={setLanguage}
+ options={LANGUAGES}
+ />
+ </ExpandableRow>
+ <ExpandableRow
+ label="Preferred currency"
+ value={
+ CURRENCIES.find(c => c.value === currency)?.label ??
+ currency
+ }
+ isExpanded={expandedRow === 'currency'}
+ onEdit={() => handleEdit('currency')}
+ onCancel={handleCancel}
+ onSave={handleSave}>
+ <XDSSelector
+ label="Currency"
+ isLabelHidden
+ size="lg"
+ value={currency}
+ onChange={setCurrency}
+ options={CURRENCIES}
+ />
+ </ExpandableRow>
+ <ExpandableRow
+ label="Time zone"
+ value={
+ TIMEZONES.find(t => t.value === timezone)?.label ??
+ timezone
+ }
+ isExpanded={expandedRow === 'timezone'}
+ onEdit={() => handleEdit('timezone')}
+ onCancel={handleCancel}
+ onSave={handleSave}>
+ <XDSSelector
+ label="Time zone"
+ isLabelHidden
+ size="lg"
+ value={timezone}
+ onChange={setTimezone}
+ options={TIMEZONES}
+ />
+ </ExpandableRow>
+ </XDSVStack>
+ </XDSVStack>
+ )}
+
+ {activeNav === 'Privacy' && (
+ <XDSVStack gap={6}>
+ <XDSVStack gap={8}>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Messages</XDSHeading>
+ <XDSVStack xstyle={styles.rowPadding}>
+ <XDSSwitch
+ label="Show people when I've read their messages."
+ value={readReceipts}
+ onChange={setReadReceipts}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
</XDSVStack>
+ <XDSHStack
+ hAlign="between"
+ vAlign="center"
+ xstyle={styles.rowPadding}>
+ <XDSText type="body" weight="semibold">
+ Blocked people
+ </XDSText>
+ <XDSLink label="View" href="#">
+ View
+ </XDSLink>
+ </XDSHStack>
+ <XDSDivider />
+ </XDSVStack>
- {/* Reviews */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Reviews</XDSHeading>
- <div>
- <XDSText type="supporting" color="secondary">
- Choose what&apos;s shared when you write a review.{' '}
- <XDSLink
- label="Learn more"
- href="#"
- type="supporting">
- Learn more
- </XDSLink>
- </XDSText>
- </div>
- <div {...stylex.props(styles.marginTop16)}>
- <XDSVStack gap={4}>
- <XDSSwitch
- label="Show my home city and country"
- description="Ex: City and country"
- value={showCity}
- onChange={setShowCity}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my trip type"
- description="Ex: Stayed with kids or pets"
- value={showTripType}
- onChange={setShowTripType}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my length of stay"
- description="Ex: A few nights, about a week, etc."
- value={showStayLength}
- onChange={setShowStayLength}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my booked services"
- description="Ex: Gourmet brunch or tasting menu"
- value={showServices}
- onChange={setShowServices}
- labelPosition="start"
- labelSpacing="spread"
- />
- </XDSVStack>
- </div>
- <div {...stylex.props(styles.marginTop16)}>
- <XDSDivider />
- </div>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Listings</XDSHeading>
+ <XDSVStack xstyle={styles.rowPadding}>
+ <XDSSwitch
+ label="Include my listing(s) in search engines"
+ description="Turning this on means search engines, like Google, will display your listing page(s) in search results."
+ value={searchEngines}
+ onChange={setSearchEngines}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
</XDSVStack>
+ <XDSDivider />
+ </XDSVStack>
- {/* Data privacy */}
+ <XDSVStack gap={4}>
+ <XDSHeading level={3}>Reviews</XDSHeading>
+ <XDSText type="supporting" color="secondary">
+ Choose what&apos;s shared when you write a review.{' '}
+ <XDSLink
+ label="Learn more"
+ href="#"
+ type="supporting">
+ Learn more
+ </XDSLink>
+ </XDSText>
<XDSVStack gap={4}>
- <XDSHeading level={3}>Data privacy</XDSHeading>
- <XDSCard padding={4}>
- <XDSHStack hAlign="between" vAlign="center">
- <XDSText type="body">
- Request my personal data
- </XDSText>
- <XDSLink label="Request" href="#">
- Request
- </XDSLink>
- </XDSHStack>
- </XDSCard>
<XDSSwitch
- label="Help improve AI-powered features"
- description="When this is on, we use your data to develop and improve AI models."
- value={aiFeatures}
- onChange={setAiFeatures}
+ label="Show my home city and country"
+ description="Ex: City and country"
+ value={showCity}
+ onChange={setShowCity}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ <XDSSwitch
+ label="Show my trip type"
+ description="Ex: Stayed with kids or pets"
+ value={showTripType}
+ onChange={setShowTripType}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ <XDSSwitch
+ label="Show my length of stay"
+ description="Ex: A few nights, about a week, etc."
+ value={showStayLength}
+ onChange={setShowStayLength}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ <XDSSwitch
+ label="Show my booked services"
+ description="Ex: Gourmet brunch or tasting menu"
+ value={showServices}
+ onChange={setShowServices}
labelPosition="start"
labelSpacing="spread"
/>
- <XDSCard padding={4}>
- <XDSHStack hAlign="between" vAlign="center">
- <XDSText type="body">Delete my account</XDSText>
- <XDSLink label="Delete" href="#">
- Delete
- </XDSLink>
- </XDSHStack>
- </XDSCard>
- <XDSCard>
- <XDSSection variant="wash">
- <XDSHStack gap={4} vAlign="start">
- <div
- {...stylex.props(
- styles.iconBox,
- styles.iconBoxSurface,
- )}>
- <XDSIcon icon={ShieldCheckIcon} size="lg" />
- </div>
- <XDSVStack gap={1}>
- <XDSText type="body" weight="bold">
- Committed to privacy
- </XDSText>
- <XDSText type="supporting" color="secondary">
- We&apos;re committed to keeping your data
- protected. See details in our{' '}
- <XDSLink
- label="Privacy Policy"
- href="#"
- type="supporting">
- Privacy Policy
- </XDSLink>
- .
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </XDSSection>
- </XDSCard>
</XDSVStack>
+ <XDSDivider />
+ </XDSVStack>
+
+ <XDSVStack gap={4}>
+ <XDSHeading level={3}>Data privacy</XDSHeading>
+ <XDSCard>
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSText type="body">
+ Request my personal data
+ </XDSText>
+ <XDSLink label="Request" href="#">
+ Request
+ </XDSLink>
+ </XDSHStack>
+ </XDSCard>
+ <XDSSwitch
+ label="Help improve AI-powered features"
+ description="When this is on, we use your data to develop and improve AI models."
+ value={aiFeatures}
+ onChange={setAiFeatures}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ <XDSCard>
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSText type="body">Delete my account</XDSText>
+ <XDSLink label="Delete" href="#">
+ Delete
+ </XDSLink>
+ </XDSHStack>
+ </XDSCard>
+ <XDSCard variant="muted">
+ <XDSHStack gap={4} vAlign="start">
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={ShieldCheckIcon} />
+ </XDSCenter>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Committed to privacy
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ We&apos;re committed to keeping your data
+ protected. See details in our{' '}
+ <XDSLink
+ label="Privacy Policy"
+ href="#"
+ type="supporting">
+ Privacy Policy
+ </XDSLink>
+ .
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ </XDSCard>
</XDSVStack>
</XDSVStack>
- )}
- </div>
- </XDSLayoutContent>
- }
- />
- </div>
+ </XDSVStack>
+ )}
+ </XDSVStack>
+ </XDSLayoutContent>
+ }
+ />
</XDSDialog>
- </div>
+ </XDSAppShell>
);
}
diff --git a/packages/cli/templates/pages/settings-dialog/template.doc.mjs b/packages/cli/templates/pages/settings-dialog/template.doc.mjs
index 28d4237256..0e706e3b8a 100644
--- a/packages/cli/templates/pages/settings-dialog/template.doc.mjs
+++ b/packages/cli/templates/pages/settings-dialog/template.doc.mjs
@@ -2,6 +2,7 @@
export const doc = {
type: 'page',
name: 'Settings (Dialog)',
- description: 'Account settings in a dialog with sidebar nav',
+ description:
+ 'Account settings in a modal dialog with sidebar navigation and multi-section content',
isReady: true,
};
diff --git a/packages/cli/templates/pages/settings-sidebar/page.tsx b/packages/cli/templates/pages/settings-sidebar/page.tsx
index 708f443c3c..f73681ad12 100644
--- a/packages/cli/templates/pages/settings-sidebar/page.tsx
+++ b/packages/cli/templates/pages/settings-sidebar/page.tsx
@@ -2,20 +2,21 @@
import {useState} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSAppShell} from '@xds/core/AppShell';
+import {XDSVStack, XDSHStack, XDSStackItem} from '@xds/core/Layout';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSLink} from '@xds/core/Link';
import {XDSButton} from '@xds/core/Button';
import {XDSSelector} from '@xds/core/Selector';
-import {XDSTextInput} from '@xds/core/TextInput';
import {XDSCard} from '@xds/core/Card';
import {XDSSection} from '@xds/core/Section';
import {XDSSwitch} from '@xds/core/Switch';
import {XDSDivider} from '@xds/core/Divider';
import {XDSTabList, XDSTab} from '@xds/core/TabList';
import {XDSBadge} from '@xds/core/Badge';
-import {colorVars} from '@xds/core/theme/tokens.stylex';
+import {XDSIcon} from '@xds/core/Icon';
+import {XDSCenter} from '@xds/core/Center';
import {
UserIcon,
LockClosedIcon,
@@ -32,15 +33,35 @@ import {
} from '@heroicons/react/24/outline';
const styles = stylex.create({
- pageBg: {
- backgroundColor: colorVars['--color-background-surface'],
+ iconBox: {
+ borderRadius: 12,
+ backgroundColor: 'var(--xds-color-background-surface, #fff)',
+ flexShrink: 0,
},
- flatCard: {
- backgroundColor: colorVars['--color-background-body'],
- borderWidth: 0,
+ rowPadding: {
+ paddingTop: 16,
+ paddingBottom: 16,
},
- noBorder: {
- borderWidth: 0,
+ cardContentPadding: {
+ paddingLeft: 16,
+ paddingRight: 16,
+ },
+ contentCenter: {
+ maxWidth: 700,
+ marginLeft: 'auto',
+ marginRight: 'auto',
+ paddingLeft: 48,
+ paddingRight: 48,
+ },
+ sideNavPadding: {
+ paddingTop: 16,
+ paddingBottom: 16,
+ paddingLeft: 12,
+ paddingRight: 12,
+ },
+ sideNavHeading: {
+ marginLeft: 16,
+ marginRight: 16,
},
});
@@ -59,7 +80,6 @@ interface InfoRow {
label: string;
value: string;
action: string;
- icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
}
const LOGIN_ROWS: InfoRow[] = [
@@ -92,36 +112,26 @@ const DEVICE_ROWS: {
function InfoRowItem({label, value, action}: InfoRow) {
return (
<>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'flex-start',
- padding: '16px 0',
- }}>
- <div>
+ <XDSHStack hAlign="between" vAlign="start" xstyle={styles.rowPadding}>
+ <XDSVStack gap={0}>
<XDSText type="body" weight="semibold" display="block">
{label}
</XDSText>
<XDSText type="supporting" color="secondary" display="block">
{value}
</XDSText>
- </div>
+ </XDSVStack>
{action && (
<XDSLink label={action} href="#">
{action}
</XDSLink>
)}
- </div>
+ </XDSHStack>
<XDSDivider />
</>
);
}
-// ---------------------------------------------------------------------------
-// Expandable settings row (Airbnb-style inline edit)
-// ---------------------------------------------------------------------------
-
interface ExpandableRowProps {
label: string;
value: string;
@@ -144,34 +154,26 @@ function ExpandableRow({
return (
<>
{isExpanded ? (
- <div style={{padding: '16px 0'}}>
- <div style={{marginBottom: 16}}>
- <XDSText type="body" weight="semibold" display="block">
- {label}
- </XDSText>
- </div>
- <div style={{marginBottom: 16}}>{children}</div>
+ <XDSVStack gap={4} xstyle={styles.rowPadding}>
+ <XDSText type="body" weight="semibold" display="block">
+ {label}
+ </XDSText>
+ {children}
<XDSHStack gap={2}>
<XDSButton label="Save" variant="primary" onClick={onSave} />
<XDSButton label="Cancel" variant="ghost" onClick={onCancel} />
</XDSHStack>
- </div>
+ </XDSVStack>
) : (
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'flex-start',
- padding: '16px 0',
- }}>
- <div>
+ <XDSHStack hAlign="between" vAlign="start" xstyle={styles.rowPadding}>
+ <XDSVStack gap={0}>
<XDSText type="body" weight="semibold" display="block">
{label}
</XDSText>
<XDSText type="supporting" color="secondary" display="block">
{value}
</XDSText>
- </div>
+ </XDSVStack>
<XDSLink
label="Edit"
href="#"
@@ -181,7 +183,7 @@ function ExpandableRow({
}}>
Edit
</XDSLink>
- </div>
+ </XDSHStack>
)}
<XDSDivider />
</>
@@ -225,656 +227,503 @@ export default function SettingsSecurityTemplate() {
const [showServices, setShowServices] = useState(true);
const [aiFeatures, setAiFeatures] = useState(true);
- // Languages & currency state
const [expandedRow, setExpandedRow] = useState<string | null>(null);
const [language, setLanguage] = useState('en-CA');
const [currency, setCurrency] = useState('CAD');
const [timezone, setTimezone] = useState('ET');
- const [firstName, setFirstName] = useState('Alex');
- const [lastName, setLastName] = useState('Johnson');
- const [email, setEmail] = useState('[email protected]');
- const [phone, setPhone] = useState('+1 (416) 555-0123');
return (
- <div
- {...stylex.props(styles.pageBg)}
- style={{
- position: 'fixed' as const,
- inset: 0,
- display: 'flex',
- flexDirection: 'row',
- overflow: 'hidden',
- }}>
- {/* Sidebar */}
- <nav
- style={{
- width: 280,
- paddingTop: 16,
- paddingLeft: 12,
- paddingRight: 12,
- paddingBottom: 16,
- borderRight: '1px solid var(--xds-color-border-primary, #e5e5e5)',
- flexShrink: 0,
- height: '100%',
- overflowY: 'auto' as const,
- }}>
- <XDSVStack gap={4}>
- <div style={{paddingLeft: 16, paddingRight: 16}}>
- <XDSHeading level={2}>Account settings</XDSHeading>
- </div>
- <XDSList density="spacious">
- {NAV_ITEMS.map(item => (
+ <XDSAppShell
+ height="fill"
+ variant="section"
+ contentPadding={4}
+ sideNav={
+ <XDSVStack gap={4} xstyle={styles.sideNavPadding}>
+ <XDSHeading level={2} xstyle={styles.sideNavHeading}>Account settings</XDSHeading>
+ <XDSList density="spacious">
+ {NAV_ITEMS.map(item => (
+ <XDSListItem
+ key={item.label}
+ label={item.label}
+ startContent={<XDSIcon icon={item.icon} />}
+ isSelected={activeNav === item.label}
+ onClick={() => setActiveNav(item.label)}
+ />
+ ))}
+ </XDSList>
+ <XDSDivider />
+ <XDSList density="spacious">
<XDSListItem
- key={item.label}
- label={item.label}
- startContent={<item.icon style={{width: 20, height: 20}} />}
- isSelected={activeNav === item.label}
- onClick={() => setActiveNav(item.label)}
+ label="Professional hosting tools"
+ startContent={<XDSIcon icon={WrenchScrewdriverIcon} />}
+ onClick={() => {}}
/>
- ))}
- </XDSList>
- <XDSDivider />
- <XDSList density="spacious">
- <XDSListItem
- label="Professional hosting tools"
- startContent={
- <WrenchScrewdriverIcon style={{width: 20, height: 20}} />
- }
- onClick={() => {}}
- />
- </XDSList>
+ </XDSList>
</XDSVStack>
- </nav>
-
- {/* Content */}
- <div
- style={{
- flex: 1,
- overflowY: 'auto' as const,
- height: '100%',
- }}>
- <div style={{maxWidth: 700, padding: '16px 48px', margin: '0 auto'}}>
- {activeNav === 'Login & security' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Login &amp; security</XDSHeading>
-
- <div style={{marginLeft: -12, overflow: 'hidden'}}>
- <XDSTabList
- value={activeTab}
- onChange={setActiveTab}
- hasDivider>
- <XDSTab value="login" label="Login" />
- <XDSTab value="shared" label="Shared access" />
- </XDSTabList>
- </div>
-
- {activeTab === 'login' && (
- <XDSVStack gap={8}>
- {/* Login section */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Login</XDSHeading>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
- {LOGIN_ROWS.map(row => (
- <InfoRowItem key={row.label} {...row} />
- ))}
- </XDSVStack>
-
- {/* Social accounts */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Social accounts</XDSHeading>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
- {SOCIAL_ROWS.map(row => (
- <InfoRowItem key={row.label} {...row} />
- ))}
- </XDSVStack>
-
- {/* Device history */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Device history</XDSHeading>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
- {DEVICE_ROWS.map((device, i) => (
- <div key={i}>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'flex-start',
- padding: '16px 0',
- gap: 12,
- }}>
- <ComputerDesktopIcon
- style={{
- width: 32,
- height: 32,
- flexShrink: 0,
- marginTop: 2,
- }}
- />
- <div style={{flex: 1}}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- }}>
- <XDSText type="body" weight="semibold">
- {device.label}
- </XDSText>
- {device.badge && (
- <XDSBadge label={device.badge} />
- )}
- </div>
- <XDSText type="supporting" color="secondary">
- {device.location}
- </XDSText>
- </div>
- {device.action && (
- <XDSLink label={device.action} href="#">
- {device.action}
- </XDSLink>
- )}
- </div>
- <XDSDivider />
- </div>
- ))}
- </XDSVStack>
-
- {/* Account */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Account</XDSHeading>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'flex-start',
- padding: '16px 0',
- }}>
- <div>
- <XDSText type="body" weight="semibold" display="block">
- Deactivate your account
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- This action cannot be undone
- </XDSText>
- </div>
- <XDSLink label="Deactivate" href="#">
- Deactivate
- </XDSLink>
- </div>
- <XDSDivider />
- </XDSVStack>
+ }>
+ <XDSVStack gap={0} xstyle={styles.contentCenter}>
+ {activeNav === 'Login & security' && (
+ <XDSVStack gap={6}>
+ <XDSHeading level={2}>Login &amp; security</XDSHeading>
+
+ <XDSTabList
+ value={activeTab}
+ onChange={setActiveTab}
+ hasDivider>
+ <XDSTab value="login" label="Login" />
+ <XDSTab value="shared" label="Shared access" />
+ </XDSTabList>
+
+ {activeTab === 'login' && (
+ <XDSVStack gap={8}>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Login</XDSHeading>
+ <XDSDivider />
+ {LOGIN_ROWS.map(row => (
+ <InfoRowItem key={row.label} {...row} />
+ ))}
</XDSVStack>
- )}
- {activeTab === 'shared' && (
- <XDSVStack gap={8}>
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Shared access</XDSHeading>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
- <div style={{paddingTop: 16}}>
- <XDSText type="body" color="secondary">
- Review each request carefully before approving access.
- We&apos;ll email your employee or co-worker a 4-digit
- code that lets them log into your account with their
- trusted device.
- </XDSText>
- </div>
- </XDSVStack>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Social accounts</XDSHeading>
+ <XDSDivider />
+ {SOCIAL_ROWS.map(row => (
+ <InfoRowItem key={row.label} {...row} />
+ ))}
+ </XDSVStack>
- <XDSCard padding={0} xstyle={styles.noBorder}>
- <XDSSection variant="wash" style={{padding: 16}}>
- <div
- style={{
- display: 'flex',
- gap: 16,
- alignItems: 'flex-start',
- }}>
- <div
- style={{
- width: 48,
- height: 48,
- borderRadius: 12,
- backgroundColor:
- 'var(--xds-color-background-surface, #fff)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- }}>
- <LockClosedIcon style={{width: 24, height: 24}} />
- </div>
- <XDSVStack gap={1}>
- <XDSText type="body" weight="bold">
- Adding devices from people you trust
- </XDSText>
- <XDSText type="body" color="secondary">
- When you approve a request, you grant someone full
- access to your account. They&apos;ll be able to
- change reservations and send messages on your
- behalf.
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Device history</XDSHeading>
+ <XDSDivider />
+ {DEVICE_ROWS.map((device, i) => (
+ <XDSHStack
+ key={i}
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSIcon icon={ComputerDesktopIcon} />
+ <XDSStackItem size="fill">
+ <XDSVStack gap={0}>
+ <XDSHStack gap={2} vAlign="center">
+ <XDSText type="body" weight="semibold">
+ {device.label}
+ </XDSText>
+ {device.badge && (
+ <XDSBadge label={device.badge} />
+ )}
+ </XDSHStack>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ {device.location}
</XDSText>
</XDSVStack>
- </div>
- </XDSSection>
- </XDSCard>
+ </XDSStackItem>
+ {device.action && (
+ <XDSLink label={device.action} href="#">
+ {device.action}
+ </XDSLink>
+ )}
+ </XDSHStack>
+ ))}
+ <XDSDivider />
</XDSVStack>
- )}
- </XDSVStack>
- )}
-
- {activeNav === 'Privacy' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Privacy</XDSHeading>
- <XDSVStack gap={8}>
- {/* Messages */}
<XDSVStack gap={0}>
- <XDSHeading level={3}>Messages</XDSHeading>
- <div style={{marginTop: 16}}>
- <XDSSwitch
- label="Show people when I've read their messages."
- value={readReceipts}
- onChange={setReadReceipts}
- labelPosition="start"
- labelSpacing="spread"
- />
- </div>
- <div style={{padding: '16px 0'}}>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- }}>
- <XDSText type="body" weight="semibold">
- Blocked people
+ <XDSHeading level={3}>Account</XDSHeading>
+ <XDSDivider />
+ <XDSHStack
+ hAlign="between"
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSVStack gap={0}>
+ <XDSText type="body" weight="semibold" display="block">
+ Deactivate your account
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ This action cannot be undone
</XDSText>
- <XDSLink label="View" href="#">
- View
- </XDSLink>
- </div>
- </div>
+ </XDSVStack>
+ <XDSLink label="Deactivate" href="#">
+ Deactivate
+ </XDSLink>
+ </XDSHStack>
<XDSDivider />
</XDSVStack>
+ </XDSVStack>
+ )}
- {/* Listings */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Listings</XDSHeading>
- <div style={{marginTop: 16}}>
- <XDSSwitch
- label="Include my listing(s) in search engines"
- description="Turning this on means search engines, like Google, will display your listing page(s) in search results."
- value={searchEngines}
- onChange={setSearchEngines}
- labelPosition="start"
- labelSpacing="spread"
- />
- </div>
- <div style={{marginTop: 8}}>
- <XDSDivider />
- </div>
+ {activeTab === 'shared' && (
+ <XDSVStack gap={8}>
+ <XDSVStack gap={2}>
+ <XDSHeading level={3}>Shared access</XDSHeading>
+ <XDSDivider />
+ <XDSText type="body" color="secondary">
+ Review each request carefully before approving access.
+ We&apos;ll email your employee or co-worker a 4-digit code
+ that lets them log into your account with their trusted
+ device.
+ </XDSText>
</XDSVStack>
- {/* Reviews */}
- <XDSVStack gap={0}>
- <XDSHeading level={3}>Reviews</XDSHeading>
- <div>
- <XDSText type="supporting" color="secondary">
- Choose what&apos;s shared when you write a review.{' '}
- <XDSLink label="Learn more" href="#" type="supporting">
- Learn more
- </XDSLink>
- </XDSText>
- </div>
- <div style={{marginTop: 16}}>
- <XDSVStack gap={4}>
- <XDSSwitch
- label="Show my home city and country"
- description="Ex: City and country"
- value={showCity}
- onChange={setShowCity}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my trip type"
- description="Ex: Stayed with kids or pets"
- value={showTripType}
- onChange={setShowTripType}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my length of stay"
- description="Ex: A few nights, about a week, etc."
- value={showStayLength}
- onChange={setShowStayLength}
- labelPosition="start"
- labelSpacing="spread"
- />
- <XDSSwitch
- label="Show my booked services"
- description="Ex: Gourmet brunch or tasting menu"
- value={showServices}
- onChange={setShowServices}
- labelPosition="start"
- labelSpacing="spread"
- />
+ <XDSCard variant="muted">
+ <XDSHStack gap={4} vAlign="start">
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={LockClosedIcon} />
+ </XDSCenter>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Adding devices from people you trust
+ </XDSText>
+ <XDSText type="body" color="secondary">
+ When you approve a request, you grant someone full
+ access to your account. They&apos;ll be able to change
+ reservations and send messages on your behalf.
+ </XDSText>
</XDSVStack>
- </div>
- <div style={{marginTop: 16}}>
- <XDSDivider />
- </div>
- </XDSVStack>
+ </XDSHStack>
+ </XDSCard>
+ </XDSVStack>
+ )}
+ </XDSVStack>
+ )}
- {/* Data privacy */}
- <XDSVStack gap={4}>
- <XDSHeading level={3}>Data privacy</XDSHeading>
- <XDSCard padding={4}>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- }}>
- <XDSText type="body">Request my personal data</XDSText>
- <XDSLink label="Request" href="#">
- Request
- </XDSLink>
- </div>
- </XDSCard>
+ {activeNav === 'Languages & currency' && (
+ <XDSVStack gap={6}>
+ <XDSHeading level={2}>Languages &amp; currency</XDSHeading>
+ <XDSVStack gap={0}>
+ <ExpandableRow
+ label="Preferred language"
+ value={
+ LANGUAGES.find(l => l.value === language)?.label ?? language
+ }
+ isExpanded={expandedRow === 'language'}
+ onEdit={() => setExpandedRow('language')}
+ onCancel={() => setExpandedRow(null)}
+ onSave={() => setExpandedRow(null)}>
+ <XDSSelector
+ label="Language"
+ isLabelHidden
+ size="lg"
+ value={language}
+ onChange={setLanguage}
+ options={LANGUAGES}
+ />
+ </ExpandableRow>
+ <ExpandableRow
+ label="Preferred currency"
+ value={
+ CURRENCIES.find(c => c.value === currency)?.label ?? currency
+ }
+ isExpanded={expandedRow === 'currency'}
+ onEdit={() => setExpandedRow('currency')}
+ onCancel={() => setExpandedRow(null)}
+ onSave={() => setExpandedRow(null)}>
+ <XDSSelector
+ label="Currency"
+ isLabelHidden
+ size="lg"
+ value={currency}
+ onChange={setCurrency}
+ options={CURRENCIES}
+ />
+ </ExpandableRow>
+ <ExpandableRow
+ label="Time zone"
+ value={
+ TIMEZONES.find(t => t.value === timezone)?.label ?? timezone
+ }
+ isExpanded={expandedRow === 'timezone'}
+ onEdit={() => setExpandedRow('timezone')}
+ onCancel={() => setExpandedRow(null)}
+ onSave={() => setExpandedRow(null)}>
+ <XDSSelector
+ label="Time zone"
+ isLabelHidden
+ size="lg"
+ value={timezone}
+ onChange={setTimezone}
+ options={TIMEZONES}
+ />
+ </ExpandableRow>
+ </XDSVStack>
+ </XDSVStack>
+ )}
+
+ {activeNav === 'Personal information' && (
+ <XDSVStack gap={6}>
+ <XDSHeading level={2}>Personal info</XDSHeading>
+ <XDSVStack gap={0}>
+ <InfoRowItem
+ label="Legal name"
+ value="Alex Johnson"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Preferred first name"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Email address"
+ value="a***[email protected]"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Phone number"
+ value="+1 ***-***-0123"
+ action="Edit"
+ />
+ <InfoRowItem
+ label="Identity verification"
+ value="Verified"
+ action=""
+ />
+ <InfoRowItem
+ label="Residential address"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Mailing address"
+ value="Not provided"
+ action="Add"
+ />
+ <InfoRowItem
+ label="Emergency contact"
+ value="Provided"
+ action="Edit"
+ />
+ </XDSVStack>
+
+ <XDSCard padding={0}>
+ <XDSVStack gap={0} xstyle={styles.cardContentPadding}>
+ <XDSHStack gap={3} vAlign="start" xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={LockClosedIcon} />
+ </XDSCenter>
+ <XDSVStack gap={0}>
+ <XDSText type="body" weight="semibold" display="block">
+ Why isn&apos;t my info shown here?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ We&apos;re hiding some account details to protect your
+ identity.
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ <XDSDivider />
+ <XDSHStack
+ gap={3}
+ vAlign="start"
+ xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={PencilSquareIcon} />
+ </XDSCenter>
+ <XDSVStack gap={0}>
+ <XDSText type="body" weight="semibold" display="block">
+ Which details can be edited?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ Contact info and personal details can be edited. If this
+ info was used to verify your identity, you&apos;ll need
+ to get verified again the next time you book—or to
+ continue hosting.
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ <XDSDivider />
+ <XDSHStack gap={3} vAlign="start" xstyle={styles.rowPadding}>
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={ShareIcon} />
+ </XDSCenter>
+ <XDSVStack gap={0}>
+ <XDSText type="body" weight="semibold" display="block">
+ What info is shared with others?
+ </XDSText>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ display="block">
+ We only release contact information after a reservation
+ is confirmed.
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ </XDSVStack>
+ </XDSCard>
+ </XDSVStack>
+ )}
+
+ {activeNav === 'Privacy' && (
+ <XDSVStack gap={6}>
+ <XDSHeading level={2}>Privacy</XDSHeading>
+
+ <XDSVStack gap={8}>
+ <XDSVStack gap={0}>
+ <XDSHeading level={3}>Messages</XDSHeading>
+ <XDSVStack xstyle={styles.rowPadding}>
<XDSSwitch
- label="Help improve AI-powered features"
- description="When this is on, we use your data to develop and improve AI models."
- value={aiFeatures}
- onChange={setAiFeatures}
+ label="Show people when I've read their messages."
+ value={readReceipts}
+ onChange={setReadReceipts}
labelPosition="start"
labelSpacing="spread"
/>
- <XDSCard padding={4}>
- <div
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- }}>
- <XDSText type="body">Delete my account</XDSText>
- <XDSLink label="Delete" href="#">
- Delete
- </XDSLink>
- </div>
- </XDSCard>
- <XDSCard padding={0} xstyle={styles.noBorder}>
- <XDSSection variant="wash" style={{padding: 16}}>
- <div
- style={{
- display: 'flex',
- gap: 16,
- alignItems: 'flex-start',
- }}>
- <div
- style={{
- width: 48,
- height: 48,
- borderRadius: 12,
- backgroundColor:
- 'var(--xds-color-background-surface, #fff)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- }}>
- <ShieldCheckIcon style={{width: 24, height: 24}} />
- </div>
- <XDSVStack gap={1}>
- <XDSText type="body" weight="bold">
- Committed to privacy
- </XDSText>
- <XDSText type="supporting" color="secondary">
- We&apos;re committed to keeping your data protected.
- See details in our{' '}
- <XDSLink
- label="Privacy Policy"
- href="#"
- type="supporting">
- Privacy Policy
- </XDSLink>
- .
- </XDSText>
- </XDSVStack>
- </div>
- </XDSSection>
- </XDSCard>
</XDSVStack>
+ <XDSHStack
+ hAlign="between"
+ vAlign="center"
+ xstyle={styles.rowPadding}>
+ <XDSText type="body" weight="semibold">
+ Blocked people
+ </XDSText>
+ <XDSLink label="View" href="#">
+ View
+ </XDSLink>
+ </XDSHStack>
+ <XDSDivider />
</XDSVStack>
- </XDSVStack>
- )}
- {activeNav === 'Languages & currency' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Languages &amp; currency</XDSHeading>
<XDSVStack gap={0}>
- <ExpandableRow
- label="Preferred language"
- value={
- LANGUAGES.find(l => l.value === language)?.label ?? language
- }
- isExpanded={expandedRow === 'language'}
- onEdit={() => setExpandedRow('language')}
- onCancel={() => setExpandedRow(null)}
- onSave={() => setExpandedRow(null)}>
- <XDSSelector
- label="Language"
- isLabelHidden
- size="lg"
- value={language}
- onChange={setLanguage}
- options={LANGUAGES}
+ <XDSHeading level={3}>Listings</XDSHeading>
+ <XDSVStack xstyle={styles.rowPadding}>
+ <XDSSwitch
+ label="Include my listing(s) in search engines"
+ description="Turning this on means search engines, like Google, will display your listing page(s) in search results."
+ value={searchEngines}
+ onChange={setSearchEngines}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ </XDSVStack>
+ <XDSDivider />
+ </XDSVStack>
+
+ <XDSVStack gap={4}>
+ <XDSHeading level={3}>Reviews</XDSHeading>
+ <XDSText type="supporting" color="secondary">
+ Choose what&apos;s shared when you write a review.{' '}
+ <XDSLink label="Learn more" href="#" type="supporting">
+ Learn more
+ </XDSLink>
+ </XDSText>
+ <XDSVStack gap={4}>
+ <XDSSwitch
+ label="Show my home city and country"
+ description="Ex: City and country"
+ value={showCity}
+ onChange={setShowCity}
+ labelPosition="start"
+ labelSpacing="spread"
/>
- </ExpandableRow>
- <ExpandableRow
- label="Preferred currency"
- value={
- CURRENCIES.find(c => c.value === currency)?.label ??
- currency
- }
- isExpanded={expandedRow === 'currency'}
- onEdit={() => setExpandedRow('currency')}
- onCancel={() => setExpandedRow(null)}
- onSave={() => setExpandedRow(null)}>
- <XDSSelector
- label="Currency"
- isLabelHidden
- size="lg"
- value={currency}
- onChange={setCurrency}
- options={CURRENCIES}
+ <XDSSwitch
+ label="Show my trip type"
+ description="Ex: Stayed with kids or pets"
+ value={showTripType}
+ onChange={setShowTripType}
+ labelPosition="start"
+ labelSpacing="spread"
/>
- </ExpandableRow>
- <ExpandableRow
- label="Time zone"
- value={
- TIMEZONES.find(t => t.value === timezone)?.label ?? timezone
- }
- isExpanded={expandedRow === 'timezone'}
- onEdit={() => setExpandedRow('timezone')}
- onCancel={() => setExpandedRow(null)}
- onSave={() => setExpandedRow(null)}>
- <XDSSelector
- label="Time zone"
- isLabelHidden
- size="lg"
- value={timezone}
- onChange={setTimezone}
- options={TIMEZONES}
+ <XDSSwitch
+ label="Show my length of stay"
+ description="Ex: A few nights, about a week, etc."
+ value={showStayLength}
+ onChange={setShowStayLength}
+ labelPosition="start"
+ labelSpacing="spread"
+ />
+ <XDSSwitch
+ label="Show my booked services"
+ description="Ex: Gourmet brunch or tasting menu"
+ value={showServices}
+ onChange={setShowServices}
+ labelPosition="start"
+ labelSpacing="spread"
/>
- </ExpandableRow>
+ </XDSVStack>
+ <XDSDivider />
</XDSVStack>
- </XDSVStack>
- )}
- {activeNav === 'Personal information' && (
- <XDSVStack gap={6}>
- <XDSHeading level={2}>Personal info</XDSHeading>
- <XDSVStack gap={0}>
- <InfoRowItem
- label="Legal name"
- value="Alex Johnson"
- action="Edit"
- />
- <InfoRowItem
- label="Preferred first name"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Email address"
- value="a***[email protected]"
- action="Edit"
- />
- <InfoRowItem
- label="Phone number"
- value="+1 ***-***-0123"
- action="Edit"
- />
- <InfoRowItem
- label="Identity verification"
- value="Verified"
- action=""
- />
- <InfoRowItem
- label="Residential address"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Mailing address"
- value="Not provided"
- action="Add"
- />
- <InfoRowItem
- label="Emergency contact"
- value="Provided"
- action="Edit"
+ <XDSVStack gap={4}>
+ <XDSHeading level={3}>Data privacy</XDSHeading>
+ <XDSCard>
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSText type="body">Request my personal data</XDSText>
+ <XDSLink label="Request" href="#">
+ Request
+ </XDSLink>
+ </XDSHStack>
+ </XDSCard>
+ <XDSSwitch
+ label="Help improve AI-powered features"
+ description="When this is on, we use your data to develop and improve AI models."
+ value={aiFeatures}
+ onChange={setAiFeatures}
+ labelPosition="start"
+ labelSpacing="spread"
/>
+ <XDSCard>
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSText type="body">Delete my account</XDSText>
+ <XDSLink label="Delete" href="#">
+ Delete
+ </XDSLink>
+ </XDSHStack>
+ </XDSCard>
+ <XDSCard variant="muted">
+ <XDSHStack gap={4} vAlign="start">
+ <XDSCenter
+ width={48}
+ height={48}
+ xstyle={styles.iconBox}>
+ <XDSIcon icon={ShieldCheckIcon} />
+ </XDSCenter>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Committed to privacy
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ We&apos;re committed to keeping your data protected.
+ See details in our{' '}
+ <XDSLink
+ label="Privacy Policy"
+ href="#"
+ type="supporting">
+ Privacy Policy
+ </XDSLink>
+ .
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ </XDSCard>
</XDSVStack>
-
- <XDSCard padding={4} style={{marginTop: 16}}>
- <XDSVStack gap={0}>
- <div style={{paddingTop: 0, paddingBottom: 16}}>
- <XDSHStack gap={3} vAlign="start">
- <div
- style={{
- width: 48,
- height: 48,
- borderRadius: 12,
- backgroundColor:
- 'var(--xds-color-background-muted, #f5f5f5)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- }}>
- <LockClosedIcon style={{width: 24, height: 24}} />
- </div>
- <XDSVStack gap={0}>
- <XDSText type="body" weight="semibold" display="block">
- Why isn&apos;t my info shown here?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- We&apos;re hiding some account details to protect your
- identity.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- <XDSDivider />
- <div style={{padding: '16px 0'}}>
- <XDSHStack gap={3} vAlign="start">
- <div
- style={{
- width: 48,
- height: 48,
- borderRadius: 12,
- backgroundColor:
- 'var(--xds-color-background-muted, #f5f5f5)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- }}>
- <PencilSquareIcon style={{width: 24, height: 24}} />
- </div>
- <XDSVStack gap={0}>
- <XDSText type="body" weight="semibold" display="block">
- Which details can be edited?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- Contact info and personal details can be edited. If
- this info was used to verify your identity,
- you&apos;ll need to get verified again the next time
- you book—or to continue hosting.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- <XDSDivider />
- <div style={{paddingTop: 16, paddingBottom: 0}}>
- <XDSHStack gap={3} vAlign="start">
- <div
- style={{
- width: 48,
- height: 48,
- borderRadius: 12,
- backgroundColor:
- 'var(--xds-color-background-muted, #f5f5f5)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- flexShrink: 0,
- }}>
- <ShareIcon style={{width: 24, height: 24}} />
- </div>
- <XDSVStack gap={0}>
- <XDSText type="body" weight="semibold" display="block">
- What info is shared with others?
- </XDSText>
- <XDSText
- type="supporting"
- color="secondary"
- display="block">
- We only release contact information after a
- reservation is confirmed.
- </XDSText>
- </XDSVStack>
- </XDSHStack>
- </div>
- </XDSVStack>
- </XDSCard>
</XDSVStack>
- )}
- </div>
- </div>
- </div>
+ </XDSVStack>
+ )}
+ </XDSVStack>
+ </XDSAppShell>
);
}
diff --git a/packages/cli/templates/pages/settings-sidebar/template.doc.mjs b/packages/cli/templates/pages/settings-sidebar/template.doc.mjs
index a52879a1ec..a2ba77eeb1 100644
--- a/packages/cli/templates/pages/settings-sidebar/template.doc.mjs
+++ b/packages/cli/templates/pages/settings-sidebar/template.doc.mjs
@@ -2,6 +2,7 @@
export const doc = {
type: 'page',
name: 'Settings (Sidebar)',
- description: 'Account settings with sidebar nav and inline editing',
+ description:
+ 'Account settings with sidebar navigation, inline editing, and multi-section privacy controls',
isReady: true,
};
diff --git a/packages/cli/templates/pages/settings/page.tsx b/packages/cli/templates/pages/settings/page.tsx
index 938bb42b10..7c93440744 100644
--- a/packages/cli/templates/pages/settings/page.tsx
+++ b/packages/cli/templates/pages/settings/page.tsx
@@ -1,27 +1,31 @@
'use client';
import {useState} from 'react';
-import * as stylex from '@stylexjs/stylex';
-import {XDSVStack} from '@xds/core/Layout';
+import {XDSAppShell} from '@xds/core/AppShell';
+import {XDSVStack, XDSHStack, XDSStackItem} from '@xds/core/Layout';
+import {XDSGrid} from '@xds/core/Grid';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSButton} from '@xds/core/Button';
import {XDSDivider} from '@xds/core/Divider';
import {XDSCheckboxInput} from '@xds/core/CheckboxInput';
+import {XDSSection} from '@xds/core/Section';
import {XDSTypeahead} from '@xds/core/Typeahead';
+import * as stylex from '@stylexjs/stylex';
import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';
import type {XDSSearchableItem, XDSSearchSource} from '@xds/core/Typeahead';
const styles = stylex.create({
- sidebarItem: {
- padding: '8px 12px',
- borderRadius: 6,
- cursor: 'pointer',
- fontSize: 14,
+ constrainedShell: {
+ maxWidth: 1100,
+ marginInline: 'auto',
+ },
+ headerPadding: {
+ padding: 16,
},
- sidebarItemSelected: {
- fontWeight: 600,
+ sideNavWidth: {
+ minWidth: 240,
},
});
@@ -70,62 +74,31 @@ export default function SettingsTemplate() {
);
return (
- <div
- style={{minHeight: '100svh', display: 'flex', flexDirection: 'column'}}>
- {/* Header — full width with edge-to-edge divider */}
- <div
- style={{
- borderBottom: '1px solid var(--xds-color-border-primary, #e5e5e5)',
- flexShrink: 0,
- }}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '16px 16px',
- maxWidth: 1000,
- margin: '0 auto',
- }}>
- <XDSHeading level={1}>Settings</XDSHeading>
- <div style={{width: 344}}>
- <XDSTypeahead
- label="Search"
- isLabelHidden
- placeholder="Search settings..."
- searchSource={settingsSearchSource}
- value={searchValue}
- onChange={setSearchValue}
- hasEntriesOnFocus
- startIcon={MagnifyingGlassIcon}
- />
- </div>
- </div>
- </div>
-
- {/* Body — constrained */}
- <div
- style={{
- display: 'flex',
- flex: 1,
- overflow: 'hidden',
- maxWidth: 1000,
- margin: '0 auto',
- width: '100%',
- }}>
- {/* Sidebar */}
- <nav
- style={{
- width: 240,
- paddingTop: 16,
- paddingLeft: 12,
- paddingRight: 12,
- paddingBottom: 8,
- borderRight: '1px solid var(--xds-color-border-primary, #e5e5e5)',
- flexShrink: 0,
- overflowY: 'auto',
- }}>
- <XDSList density="compact">
+ <XDSAppShell
+ height="auto"
+ variant="section"
+ contentPadding={4}
+ xstyle={styles.constrainedShell}
+ topNav={
+ <XDSHStack vAlign="center" xstyle={styles.headerPadding}>
+ <XDSStackItem size="fill">
+ <XDSHeading level={1}>Settings</XDSHeading>
+ </XDSStackItem>
+ <XDSTypeahead
+ label="Search"
+ isLabelHidden
+ placeholder="Search settings..."
+ searchSource={settingsSearchSource}
+ value={searchValue}
+ onChange={setSearchValue}
+ hasEntriesOnFocus
+ startIcon={MagnifyingGlassIcon}
+ />
+ </XDSHStack>
+ }
+ sideNav={
+ <XDSSection padding={2} variant="transparent" xstyle={styles.sideNavWidth}>
+ <XDSList density="balanced">
{NAV_ITEMS.map(item => (
<XDSListItem
key={item}
@@ -135,146 +108,111 @@ export default function SettingsTemplate() {
/>
))}
</XDSList>
- </nav>
-
- {/* Content */}
- <div style={{flex: 1, padding: 16, maxWidth: 960, overflowY: 'auto'}}>
+ </XDSSection>
+ }>
+ <XDSVStack gap={4}>
+ <XDSGrid columns={2} gap={10}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={3}>Basic information</XDSHeading>
+ <XDSText type="supporting" color="secondary">
+ View and update your personal details and account information.
+ </XDSText>
+ </XDSVStack>
<XDSVStack gap={4}>
- {/* Basic information */}
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: 40,
- }}>
- <div>
- <XDSVStack gap={1}>
- <XDSHeading level={3}>Basic information</XDSHeading>
- <XDSText type="supporting" color="secondary">
- View and update your personal details and account
- information.
- </XDSText>
- </XDSVStack>
- </div>
- <div>
- <XDSVStack gap={4}>
- <XDSTextInput
- label="Username"
- value={username}
- onChange={setUsername}
- />
- <XDSTextInput
- label="First name"
- value={firstName}
- onChange={setFirstName}
- />
- <XDSTextInput
- label="Last name"
- value={lastName}
- onChange={setLastName}
- />
- <XDSTextInput
- label="Email address"
- value={email}
- onChange={setEmail}
- />
- <div>
- <XDSButton label="Save" variant="primary" />
- </div>
- </XDSVStack>
- </div>
- </div>
+ <XDSTextInput
+ label="Username"
+ value={username}
+ onChange={setUsername}
+ />
+ <XDSTextInput
+ label="First name"
+ value={firstName}
+ onChange={setFirstName}
+ />
+ <XDSTextInput
+ label="Last name"
+ value={lastName}
+ onChange={setLastName}
+ />
+ <XDSTextInput
+ label="Email address"
+ value={email}
+ onChange={setEmail}
+ />
+ <XDSHStack>
+ <XDSButton label="Save" variant="primary" />
+ </XDSHStack>
+ </XDSVStack>
+ </XDSGrid>
- <XDSDivider />
+ <XDSDivider />
- {/* Change password */}
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: 40,
- }}>
- <div>
- <XDSVStack gap={1}>
- <XDSHeading level={3}>Change password</XDSHeading>
- <XDSText type="supporting" color="secondary">
- Update your password to keep your account secure.
- </XDSText>
- </XDSVStack>
- </div>
- <div>
- <XDSVStack gap={4}>
- <XDSTextInput
- label="Verify current password"
- type="password"
- value={currentPw}
- onChange={setCurrentPw}
- />
- <XDSTextInput
- label="New password"
- type="password"
- value={newPw}
- onChange={setNewPw}
- />
- <XDSTextInput
- label="Confirm password"
- type="password"
- value={confirmPw}
- onChange={setConfirmPw}
- />
- <div>
- <XDSButton label="Save" variant="primary" />
- </div>
- </XDSVStack>
- </div>
- </div>
+ <XDSGrid columns={2} gap={10}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={3}>Change password</XDSHeading>
+ <XDSText type="supporting" color="secondary">
+ Update your password to keep your account secure.
+ </XDSText>
+ </XDSVStack>
+ <XDSVStack gap={4}>
+ <XDSTextInput
+ label="Verify current password"
+ type="password"
+ value={currentPw}
+ onChange={setCurrentPw}
+ />
+ <XDSTextInput
+ label="New password"
+ type="password"
+ value={newPw}
+ onChange={setNewPw}
+ />
+ <XDSTextInput
+ label="Confirm password"
+ type="password"
+ value={confirmPw}
+ onChange={setConfirmPw}
+ />
+ <XDSHStack>
+ <XDSButton label="Save" variant="primary" />
+ </XDSHStack>
+ </XDSVStack>
+ </XDSGrid>
- <XDSDivider />
+ <XDSDivider />
- {/* Advanced settings */}
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: 40,
- }}>
- <div>
- <XDSVStack gap={1}>
- <XDSHeading level={3}>Advanced settings</XDSHeading>
- <XDSText type="supporting" color="secondary">
- Configure detailed account preferences and security options.
- </XDSText>
- </XDSVStack>
- </div>
- <div>
- <XDSVStack gap={5}>
- <XDSCheckboxInput
- label="Data Export Access"
- description="Allow export of personal data and backups."
- value={dataExport}
- onChange={setDataExport}
- />
- <XDSCheckboxInput
- label="Allow Admin to Add Members"
- description="Admins can invite and manage members."
- value={adminMembers}
- onChange={setAdminMembers}
- />
- <XDSCheckboxInput
- label="Enable Two-Factor Authentication"
- description="Require 2FA for added account security."
- value={twoFactor}
- onChange={setTwoFactor}
- />
- <div>
- <XDSButton label="Save" variant="primary" />
- </div>
- </XDSVStack>
- </div>
- </div>
+ <XDSGrid columns={2} gap={10}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={3}>Advanced settings</XDSHeading>
+ <XDSText type="supporting" color="secondary">
+ Configure detailed account preferences and security options.
+ </XDSText>
+ </XDSVStack>
+ <XDSVStack gap={5}>
+ <XDSCheckboxInput
+ label="Data Export Access"
+ description="Allow export of personal data and backups."
+ value={dataExport}
+ onChange={setDataExport}
+ />
+ <XDSCheckboxInput
+ label="Allow Admin to Add Members"
+ description="Admins can invite and manage members."
+ value={adminMembers}
+ onChange={setAdminMembers}
+ />
+ <XDSCheckboxInput
+ label="Enable Two-Factor Authentication"
+ description="Require 2FA for added account security."
+ value={twoFactor}
+ onChange={setTwoFactor}
+ />
+ <XDSHStack>
+ <XDSButton label="Save" variant="primary" />
+ </XDSHStack>
</XDSVStack>
- </div>
- </div>
- </div>
+ </XDSGrid>
+ </XDSVStack>
+ </XDSAppShell>
);
}
diff --git a/packages/cli/templates/pages/settings/template.doc.mjs b/packages/cli/templates/pages/settings/template.doc.mjs
index 18781db68d..cd008a4432 100644
--- a/packages/cli/templates/pages/settings/template.doc.mjs
+++ b/packages/cli/templates/pages/settings/template.doc.mjs
@@ -2,6 +2,6 @@
export const doc = {
type: 'page',
name: 'Settings',
- description: 'Basic account settings page',
+ description: 'Account settings page with profile, password, and advanced configuration sections',
isReady: true,
};