import { useState } from 'react'
import { Card, Grid, Layout, Segmented, Space, Tag, Text, Title } from '../../src'
import { Demo } from '../components/Demo'
import { PropsTable } from '../components/PropsTable'
import { Section } from '../components/Section'
/** 文档里的迷你页面内容:只为了把 Layout 的结构摆出来 */
function DemoHeader() {
return (
STASH
工作台
常用推荐
设置
)
}
function DemoSider({ compact = false }: { compact?: boolean }) {
return (
常用站点
前端工具
{!compact && 设计资源}
{!compact && 推荐电影}
)
}
function DemoAside() {
return (
目录
一、内容库结构
二、令牌与主题
三、暗色模式
共 3 节
)
}
function DemoArticle() {
return (
内容库结构
分区 → 分组 → 条目三层;侧栏由内容树派生,首页卡片由 section_block 决定。
设计系统
已发布
)
}
function DemoCards() {
return (
常用站点
内容区放任何组件:卡片、列表、表格。Layout 只负责它坐在哪里。
GitHub
Figma
)
}
const RECIPES = [
{ value: 'top', label: '顶栏 + 内容' },
{ value: 'sider', label: '左栏 + 内容' },
{ value: 'aside', label: '内容 + 右栏' },
{ value: 'three', label: '三栏' },
{ value: 'narrow', label: '窄内容' },
] as const
type RecipeValue = (typeof RECIPES)[number]['value']
const CODE: Record = {
top: `} footer={}>
…
`,
sider: `} sider={} siderWidth={180}>
常用站点
`,
aside: `} aside={} maxWidth={960}>
`,
three: `}
sider={}
aside={}
siderWidth={160}
asideWidth={200}
>
`,
narrow: `} maxWidth={640}>
`,
}
export function PageLayout() {
const [recipe, setRecipe] = useState('three')
return (
setRecipe(value as RecipeValue)} />
}
sider={recipe === 'sider' || recipe === 'three' ?
: undefined}
aside={recipe === 'aside' || recipe === 'three' ?
: undefined}
footer={
© 2026 Stash}
siderWidth={recipe === 'three' ? 150 : 180}
asideWidth={190}
maxWidth={recipe === 'narrow' ? 560 : recipe === 'aside' ? 900 : 1280}
style={{ minHeight: 420 }}
>
{recipe === 'aside' || recipe === 'three' ?
: null}
{recipe === 'top' || recipe === 'sider' ?
: null}
{recipe === 'narrow' ? (
设置
单栏 + 560 最大宽度,阅读型页面常用这个组合。
自动同步
每周摘要提醒
) : null}
} stickyHeader={false} maxWidth={720}>
`}
>
} maxWidth={720} stickyHeader={false} style={{ minHeight: 280 }}>
新建条目
stickyHeader=false:页头随内容滚走,适合长表单 / 长文阅读。
} sider={} style={{ height: 320 }}>
`}
>
}
sider={
}
headerHeight={56}
height="screen"
scrollable
hideScrollbar
contentId="demo-scroll"
style={{ height: 320 }}
>
{Array.from({ length: 12 }, (_, index) => (
第 {index + 1} 行:只有内容区滚动,页头和侧栏保持不动。
))}
)
}