feat: migrate docs to Fumadocs framework
- Auto-generated sidebar from file structure - Built-in search and TOC - MDX native support with frontmatter - Removed hand-written Sidebar component - Docs now at /docs/* route (Landing/Blocks/Create/Examples unchanged) - Content in content/docs/ as MDX files
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: Article + Layer
|
||||
description: 栅格内的文章块与浮动层组件
|
||||
---
|
||||
|
||||
## Article
|
||||
|
||||
Article 是栅格内的文章块,通过 `grid-column span` 跨栏。
|
||||
|
||||
### Article API
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `span` | `number` | - | 跨多少列(≤ Section.columns)。缺省时占满全宽。 |
|
||||
| `breakable` | `boolean` | `true` | 允许打印时跨页断开。 |
|
||||
| `className` | `string` | - | 自定义 CSS 类名。 |
|
||||
| `style` | `CSSProperties` | - | 自定义内联样式。 |
|
||||
| `children` | `ReactNode` | **必填** | 文章内容。 |
|
||||
|
||||
### 跨栏示例
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={8}>
|
||||
<Headline weight="Low">短讯</Headline>
|
||||
<BodyText>...</BodyText>
|
||||
</Article>
|
||||
<Article span={16}>
|
||||
<Headline weight="Medium">主稿</Headline>
|
||||
<BodyText columns={2}>...</BodyText>
|
||||
</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
## Layer
|
||||
|
||||
Layer 脱离栅格流,使用 CSS position 定位。适合浮动拉引、浮动广告、sticky 导航等场景。
|
||||
|
||||
### Layer API
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `position` | `'absolute' \| 'fixed' \| 'sticky'` | `'absolute'` | CSS position 属性。 |
|
||||
| `top` | `string \| number` | - | 距离顶部的距离。 |
|
||||
| `left` | `string \| number` | - | 距离左侧的距离。 |
|
||||
| `right` | `string \| number` | - | 距离右侧的距离。 |
|
||||
| `bottom` | `string \| number` | - | 距离底部的距离。 |
|
||||
| `zIndex` | `number` | - | z-index 层级。 |
|
||||
| `children` | `ReactNode` | **必填** | 浮动层内容。 |
|
||||
|
||||
### Layer 浮动拉引示例
|
||||
|
||||
在文章旁边添加浮动的拉引文字。父容器需要 `position: relative`。
|
||||
|
||||
```tsx
|
||||
<div style={{ position: 'relative', minHeight: '200px' }}>
|
||||
<Article span={16}>
|
||||
<Headline weight="Low">主要文章</Headline>
|
||||
<BodyText>...</BodyText>
|
||||
</Article>
|
||||
<Layer position="absolute" top="0" right="0">
|
||||
<aside>浮动内容</aside>
|
||||
</Layer>
|
||||
</div>
|
||||
```
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: Masthead 报头
|
||||
description: 报纸门面组件,三种视觉风格
|
||||
---
|
||||
|
||||
## 概述
|
||||
|
||||
报头是报纸的门面。三个 variant 覆盖经典双线居中、哥特体、现代左对齐三种风格。
|
||||
|
||||
## API
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `title` | `string` | **必填** | 报名文字。 |
|
||||
| `variant` | `'classic' \| 'blackletter' \| 'modern'` | `'classic'` | 视觉风格。 |
|
||||
| `kicker` | `string` | - | 报名上方的小标(如 "All the News That's Fit to Print")。 |
|
||||
| `edition` | `string` | - | 版次(如 "Vol. CLXXII No. 59,678")。 |
|
||||
| `date` | `string` | - | 日期(如 "Monday, May 19, 2026")。 |
|
||||
| `price` | `string` | - | 售价(如 "$3.00")。 |
|
||||
|
||||
## Classic
|
||||
|
||||
双线居中,Cormorant Garamond 衬线。
|
||||
|
||||
```tsx
|
||||
<Masthead
|
||||
variant="classic"
|
||||
title="The Daily Chronicle"
|
||||
kicker="All the News That's Fit to Print"
|
||||
edition="Vol. CLXXII No. 59,678"
|
||||
date="Monday, May 19, 2026"
|
||||
price="$3.00"
|
||||
/>
|
||||
```
|
||||
|
||||
## Blackletter
|
||||
|
||||
UnifrakturMaguntia 哥特体,The Times 风格。
|
||||
|
||||
```tsx
|
||||
<Masthead
|
||||
variant="blackletter"
|
||||
title="The Evening Standard"
|
||||
edition="Late Final Edition"
|
||||
date="Monday, May 19, 2026"
|
||||
price="£2.50"
|
||||
/>
|
||||
```
|
||||
|
||||
## Modern
|
||||
|
||||
左对齐 + accent 强调色,适合数字优先的出版物。
|
||||
|
||||
```tsx
|
||||
<Masthead
|
||||
variant="modern"
|
||||
title="The Observer"
|
||||
kicker="Sunday Edition"
|
||||
date="May 19, 2026"
|
||||
/>
|
||||
```
|
||||
|
||||
## 使用建议
|
||||
|
||||
Masthead 默认 `gridColumn: 1 / -1`,在 Section 内自动全宽。通常放在 Layout 的第一个 Section 中,后接 Rule 分隔线。
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: 媒体组件
|
||||
description: Image、Figure、Video、PullQuote — 报纸版面中的视觉元素
|
||||
---
|
||||
|
||||
## Image
|
||||
|
||||
基础图片组件。`display: block; width: 100%`,在 Section 栅格内通过 span 跨栏。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `src` | `string` | **必填** | 图片 URL。 |
|
||||
| `alt` | `string` | **必填** | 替代文本。 |
|
||||
| `span` | `number` | - | 跨栏数。 |
|
||||
|
||||
## Figure
|
||||
|
||||
组合 Image + Caption + Credit 的语义容器。自动渲染 figcaption。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `src` | `string` | **必填** | 图片 URL。 |
|
||||
| `alt` | `string` | **必填** | 替代文本。 |
|
||||
| `caption` | `string` | - | 图片说明。 |
|
||||
| `credit` | `string` | - | 摄影师/来源(small-caps 渲染)。 |
|
||||
| `span` | `number` | - | 跨栏数。 |
|
||||
|
||||
```tsx
|
||||
<Figure
|
||||
src="https://images.unsplash.com/photo-1495020689067-958852a7765e?w=800&h=400&fit=crop"
|
||||
alt="Newspapers on a wooden table"
|
||||
caption="A view of the morning editions, arranged on the newsroom table."
|
||||
credit="Photograph by Roman Kraft / Unsplash"
|
||||
/>
|
||||
```
|
||||
|
||||
## Video
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `src` | `string` | **必填** | 视频 URL。 |
|
||||
| `poster` | `string` | - | 封面图 URL。 |
|
||||
| `caption` | `string` | - | 视频说明。 |
|
||||
| `credit` | `string` | - | 来源。 |
|
||||
| `controls` | `boolean` | `true` | 显示播放控件。 |
|
||||
| `span` | `number` | - | 跨栏数。 |
|
||||
|
||||
Video 组件与 Figure 结构类似,包裹 `<video>` 标签并附带 caption/credit。
|
||||
|
||||
## PullQuote
|
||||
|
||||
上下双 hairline + Display 字体的拉引组件。在多栏 BodyText 内设置 `spanAllColumns` 可跨所有栏(通过 `column-span: all`)。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `weight` | `'High' \| 'Medium'` | `'High'` | 视觉权重。 |
|
||||
| `span` | `number` | - | 在 Section 栅格内跨栏。 |
|
||||
| `spanAllColumns` | `boolean` | `false` | 在多栏 BodyText 内跨所有栏。 |
|
||||
| `author` | `string` | - | 引用来源。 |
|
||||
| `align` | `'left' \| 'center'` | `'left'` | 文本对齐。 |
|
||||
|
||||
### 独立使用
|
||||
|
||||
```tsx
|
||||
<PullQuote author="Senior Cabinet Official">
|
||||
We have lobbied for this kind of clarity for the better part of a decade.
|
||||
</PullQuote>
|
||||
```
|
||||
|
||||
### 在多栏 BodyText 内跨栏
|
||||
|
||||
```tsx
|
||||
<BodyText columns={3}>
|
||||
<p>...</p>
|
||||
<PullQuote spanAllColumns author="...">...</PullQuote>
|
||||
<p>...</p>
|
||||
</BodyText>
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"title": "Components",
|
||||
"pages": ["article", "masthead", "rule", "media"]
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
title: Rule 分隔线
|
||||
description: 显式分隔线组件,支持三种线型和两种方向
|
||||
---
|
||||
|
||||
## 概述
|
||||
|
||||
显式分隔线组件。三个 variant 覆盖 hairline、double、thick,支持水平和垂直方向。
|
||||
|
||||
## API
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `variant` | `'hairline' \| 'double' \| 'thick'` | `'hairline'` | 线型。 |
|
||||
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | 方向。 |
|
||||
| `span` | `number` | - | 横向时占多少列。缺省时 1 / -1 全跨。 |
|
||||
| `className` | `string` | - | 自定义 CSS 类名。 |
|
||||
| `style` | `CSSProperties` | - | 自定义内联样式。 |
|
||||
|
||||
## 水平方向三种 variant
|
||||
|
||||
```tsx
|
||||
<Rule variant="hairline" />
|
||||
<Rule variant="double" />
|
||||
<Rule variant="thick" />
|
||||
```
|
||||
|
||||
## 垂直方向
|
||||
|
||||
在两栏之间放置垂直 Rule:
|
||||
|
||||
```tsx
|
||||
<div style={{ display: 'flex', gap: '1.5rem', height: '120px' }}>
|
||||
<div>左栏内容</div>
|
||||
<Rule variant="hairline" orientation="vertical" />
|
||||
<div>右栏内容</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
## 使用建议
|
||||
|
||||
Rule 在 Section 栅格内默认 `gridColumn: 1 / -1` 全跨。如果只需要跨部分列,传入 `span` prop。垂直 Rule 适合放在 flex 容器中作为栏间分隔。
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"title": "Examples",
|
||||
"pages": ["spanning", "responsive"]
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: 响应式设计
|
||||
description: 基于 CSS media query + container query 的响应式策略
|
||||
---
|
||||
|
||||
NewspaperUI 的响应式策略完全基于 CSS media query + container query,不依赖 JavaScript 运行时计算。
|
||||
|
||||
## 断点说明
|
||||
|
||||
三个核心断点覆盖移动、平板、桌面:
|
||||
|
||||
| 断点 | 宽度 | 栏数建议 | 说明 |
|
||||
|---|---|---|---|
|
||||
| Mobile | 小于 768px | 1 栏(全宽) | 单栏堆叠,BodyText columns=1 |
|
||||
| Tablet | 768px - 1024px | 12 列 | 两栏布局,BodyText columns=2 |
|
||||
| Desktop | 大于 1024px | 24 列 | 完整多栏布局 |
|
||||
|
||||
## 实施手法
|
||||
|
||||
NewspaperUI 不再使用 JavaScript responsive 函数。所有响应式行为通过 CSS media query 和 container query 实现,零运行时开销。
|
||||
|
||||
Section 的 `gridTemplateColumns` 是 inline style,因此需要在消费侧用 CSS 覆盖。推荐做法:
|
||||
|
||||
### Media Query 方案
|
||||
|
||||
```css
|
||||
/* 在你的 globals.css 或组件 CSS 中 */
|
||||
@media (max-width: 768px) {
|
||||
.nui-section {
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
.nui-article {
|
||||
grid-column: span 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 769px) and (max-width: 1024px) {
|
||||
.nui-section[data-columns="24"] {
|
||||
grid-template-columns: repeat(12, 1fr) !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Container Query 方案
|
||||
|
||||
```css
|
||||
/* 给 Section 添加 container-type */
|
||||
.nui-section {
|
||||
container-type: inline-size;
|
||||
}
|
||||
|
||||
@container (max-width: 600px) {
|
||||
.nui-article {
|
||||
grid-column: 1 / -1 !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 视口效果
|
||||
|
||||
- **Desktop (1024px+)**: 24 列完整布局,6 + 12 + 6 三栏
|
||||
- **Tablet (768-1024px)**: 12 列简化,两栏并列
|
||||
- **Mobile (小于 768px)**: 单栏堆叠,所有 Article 全宽
|
||||
|
||||
实际项目中建议使用浏览器 DevTools 的 responsive mode 进行测试。
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
title: 跨栏布局示例
|
||||
description: 五种常见栏宽组合,演示 24 列栅格的灵活性
|
||||
---
|
||||
|
||||
五种常见栏宽组合,演示 24 列栅格的灵活性。
|
||||
|
||||
## 8 + 16
|
||||
|
||||
短讯 + 主稿:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={8}>
|
||||
<Headline weight="Low">Briefing</Headline>
|
||||
<BodyText weight="Low"><p>Short news items.</p></BodyText>
|
||||
</Article>
|
||||
<Article span={16}>
|
||||
<Headline weight="Medium">Infrastructure Review Tabled</Headline>
|
||||
<BodyText><p>Main article content...</p></BodyText>
|
||||
</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
## 6 + 12 + 6
|
||||
|
||||
三栏对称布局,中间主体 + 两侧辅助:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={6}>Weather</Article>
|
||||
<Article span={12}>Chancellor Outlines Spending Envelope</Article>
|
||||
<Article span={6}>Markets</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
## 12 + 12
|
||||
|
||||
对称双栏,适合对比报道或并列文章:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={12}>View from Westminster</Article>
|
||||
<Article span={12}>View from the Regions</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
## 4 + 16 + 4
|
||||
|
||||
窄侧栏 + 宽主体,适合带注释的长文:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={4}>Editor's note</Article>
|
||||
<Article span={16}>A Standing Technical Commission</Article>
|
||||
<Article span={4}>Related reading</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
## 24 全宽
|
||||
|
||||
单篇全宽文章,适合社论或特稿:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={24}>
|
||||
<Headline weight="High">The Quiet Revolution in Treasury Forecasting</Headline>
|
||||
<BodyText columns={4} dropCap>
|
||||
<p>...</p>
|
||||
</BodyText>
|
||||
</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
title: 栅格系统
|
||||
description: 24 列响应式栅格,CSS Grid 实现
|
||||
---
|
||||
|
||||
## 概念
|
||||
|
||||
NewspaperUI 使用 24 列栅格系统。24 列由 `Layout` 提供上下文,`Section` 在栅格内分配 `grid-template-columns`,`Article` 用 `grid-column span` 跨栏。所有跨栏统一通过 CSS Grid 完成。
|
||||
|
||||
报纸排版偏好 24 列是因为它能整除 2 / 3 / 4 / 6 / 8 / 12,足够灵活地实现 1/3、2/3、1/4、3/4 这类常见栏宽组合。
|
||||
|
||||
## Layout API
|
||||
|
||||
`Layout` 是顶层容器,提供 LayoutContext。Section 通过 useLayout 读取列数上限并自动 clamp。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `columns` | `number` | `24` | 栅格总列数。决定子 Section 的最大 columns。 |
|
||||
| `maxWidth` | `string` | `'1280px'` | 页面最大宽度。 |
|
||||
| `padding` | `string` | `'var(--nui-space-6)'` | 页面内边距。 |
|
||||
| `theme` | `'light' \| 'dark'` | - | 强制主题;省略时跟随 documentElement.dataset.theme。 |
|
||||
| `children` | `ReactNode` | **必填** | 子内容(通常是若干 Section)。 |
|
||||
|
||||
## Section API
|
||||
|
||||
`Section` 是栅格容器,`display: grid; grid-template-columns: repeat(N, 1fr)`。子 Article 通过 grid-column span 占位。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `columns` | `number` | **必填** | Section 内部栅格列数(≤ Layout.columns)。 |
|
||||
| `gap` | `string` | `'var(--nui-gutter)'` | 栏间间距。 |
|
||||
| `breakable` | `boolean` | `true` | 允许打印时跨页断开。 |
|
||||
| `divider` | `'none' \| 'top' \| 'bottom' \| 'both'` | `'none'` | 上下方向的 hairline 分隔线。 |
|
||||
|
||||
## Article API
|
||||
|
||||
`Article` 在 Section 栅格内用 `grid-column span N` 占位。span 缺省时占满 Section 全宽。
|
||||
|
||||
| 属性 | 类型 | 默认值 | 说明 |
|
||||
|---|---|---|---|
|
||||
| `span` | `number` | - | 跨多少列(0 < span ≤ Section.columns)。 |
|
||||
| `breakable` | `boolean` | `true` | 允许打印时跨页断开。 |
|
||||
| `children` | `ReactNode` | **必填** | 文章内容。 |
|
||||
|
||||
## 用法示例
|
||||
|
||||
### 8 + 16 跨栏
|
||||
|
||||
左侧短讯 8 列 + 右侧主稿 16 列:
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={8}>
|
||||
<Headline weight="Low">短讯</Headline>
|
||||
<BodyText>...</BodyText>
|
||||
</Article>
|
||||
<Article span={16}>
|
||||
<Headline weight="Medium">主稿</Headline>
|
||||
<BodyText>...</BodyText>
|
||||
</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
### 6 + 12 + 6 三栏对称
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={6}>侧栏</Article>
|
||||
<Article span={12}>主体</Article>
|
||||
<Article span={6}>侧栏</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
|
||||
### 24 全宽
|
||||
|
||||
```tsx
|
||||
<Layout columns={24}>
|
||||
<Section columns={24}>
|
||||
<Article span={24}>
|
||||
<Headline weight="High">全宽文章</Headline>
|
||||
<BodyText columns={4} dropCap>...</BodyText>
|
||||
</Article>
|
||||
</Section>
|
||||
</Layout>
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "Documentation",
|
||||
"pages": [
|
||||
"grid-system",
|
||||
"---Components---",
|
||||
"...components",
|
||||
"---Text---",
|
||||
"...text",
|
||||
"---Theme---",
|
||||
"...theme",
|
||||
"---Examples---",
|
||||
"...examples"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
---
|
||||
title: 文本组件
|
||||
description: 从 Headline 到 Caption 的完整文本谱系
|
||||
---
|
||||
|
||||
从 Headline 到 Caption 的完整文本谱系。每个组件按视觉权重映射到字体、字号、字重、行高与颜色 token,避免硬编码样式。
|
||||
|
||||
## Headline
|
||||
|
||||
三档视觉权重:High / Medium / Low。
|
||||
|
||||
```tsx
|
||||
<Headline weight="High" as="h1">
|
||||
A Quiet Revolution in the Treasury Forecast
|
||||
</Headline>
|
||||
|
||||
<Headline weight="Medium" as="h2">
|
||||
Whitehall Confirms Infrastructure Review
|
||||
</Headline>
|
||||
|
||||
<Headline weight="Low" as="h3">
|
||||
Briefing: regional rail commitments
|
||||
</Headline>
|
||||
```
|
||||
|
||||
## Subhead
|
||||
|
||||
两档视觉权重:High / Medium。
|
||||
|
||||
```tsx
|
||||
<Subhead weight="High">
|
||||
A measured recalibration of regional priorities is expected to define
|
||||
the chancellor's autumn agenda.
|
||||
</Subhead>
|
||||
|
||||
<Subhead weight="Medium">
|
||||
Officials emphasized that the headline figures should be read as a planning
|
||||
envelope rather than a binding allocation.
|
||||
</Subhead>
|
||||
```
|
||||
|
||||
## Kicker
|
||||
|
||||
朱红 small-caps,挂在 Headline 上方。
|
||||
|
||||
```tsx
|
||||
<Kicker>POLITICS · WHITEHALL</Kicker>
|
||||
<Headline weight="Medium" as="h3">
|
||||
A Standing Technical Commission, Quietly Proposed
|
||||
</Headline>
|
||||
```
|
||||
|
||||
## BodyText
|
||||
|
||||
多栏文字流组件,支持 `columns` 和 `dropCap`。
|
||||
|
||||
### 单栏(默认)
|
||||
|
||||
```tsx
|
||||
<BodyText>
|
||||
<p>默认形态,适合中等宽度的文章正文。</p>
|
||||
</BodyText>
|
||||
```
|
||||
|
||||
### 三栏 + 首字下沉
|
||||
|
||||
开启 `columns={3}` 与 `dropCap`,第一段首字母自动下沉占 2-3 行。
|
||||
|
||||
```tsx
|
||||
<BodyText columns={3} dropCap>
|
||||
<p>...</p>
|
||||
<p>...</p>
|
||||
</BodyText>
|
||||
```
|
||||
|
||||
### 两栏
|
||||
|
||||
`columns={2}`,栏间细线由 `nui-column-rule` 提供。
|
||||
|
||||
```tsx
|
||||
<BodyText columns={2}>
|
||||
<p>...</p>
|
||||
<p>...</p>
|
||||
</BodyText>
|
||||
```
|
||||
|
||||
## Quote
|
||||
|
||||
block / inline 两种变体。
|
||||
|
||||
```tsx
|
||||
{/* Block quote */}
|
||||
<Quote variant="block">
|
||||
We have lobbied for this kind of clarity for the better part of a decade.
|
||||
</Quote>
|
||||
|
||||
{/* Inline quote */}
|
||||
<BodyText>
|
||||
<p>
|
||||
按一位资深内阁人士的说法,这份评估
|
||||
<Quote variant="inline">是一个时代以来最连贯的战略蓝图</Quote>
|
||||
,但能否落地仍取决于春季立法。
|
||||
</p>
|
||||
</BodyText>
|
||||
```
|
||||
|
||||
## Byline / Dateline / Caption
|
||||
|
||||
元信息组件。
|
||||
|
||||
```tsx
|
||||
<Byline>BY ALICE SMITH</Byline>
|
||||
<Dateline>LONDON —</Dateline>
|
||||
|
||||
<figure>
|
||||
<img src="..." alt="..." />
|
||||
<Caption credit="Photograph by Jane Doe">
|
||||
A view of the Treasury terrace at dusk; the new commission will report here from May.
|
||||
</Caption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
## 视觉权重映射
|
||||
|
||||
所有文本组件的样式由 `visualWeights` 数据驱动,修改 theme 后自动同步。映射关系:
|
||||
|
||||
| 组件 | 权重 | 字体 | 字号 | 字重 | 行高 |
|
||||
|---|---|---|---|---|---|
|
||||
| Headline | High | `--font-family-display` | 48px | 700 | 1.05 |
|
||||
| Headline | Medium | `--font-family-headline` | 32px | 700 | 1.15 |
|
||||
| Headline | Low | `--font-family-headline` | 22px | 600 | 1.25 |
|
||||
| Subhead | High | `--font-family-headline` | 22px | 400 | 1.35 |
|
||||
| Subhead | Medium | `--font-family-headline` | 18px | 400 | 1.4 |
|
||||
| Kicker | - | `--font-family-meta` | 12px | 700 | 1.2 |
|
||||
| BodyText | High | `--font-family-body` | 17px | 400 | 1.65 |
|
||||
| BodyText | Medium | `--font-family-body` | 16px | 400 | 1.6 |
|
||||
| BodyText | Low | `--font-family-body` | 15px | 400 | 1.55 |
|
||||
| Byline | - | `--font-family-meta` | 12px | 600 | 1.2 |
|
||||
| Dateline | - | `--font-family-meta` | 13px | 700 | 1.2 |
|
||||
| Caption | - | `--font-family-meta` | 12px | 400 | 1.4 |
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"title": "Text",
|
||||
"pages": ["index"]
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: 主题与颜色
|
||||
description: 暖灰系 + warm off-white 设计系统
|
||||
---
|
||||
|
||||
设计哲学:暖灰系 + warm off-white。不使用纯黑(#000)也不使用纯白(#FFF),把屏幕配色带回纸面的温度。
|
||||
|
||||
## 主题切换
|
||||
|
||||
深色基调采用暖深棕黑(#14110D)而非冷蓝黑,保持报纸的纸性触感。通过 `document.documentElement.dataset.theme = 'dark'` 切换。
|
||||
|
||||
## 文字色 Token
|
||||
|
||||
| Token | 色值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--nui-text-primary` | #1A1A1A | 标题、主文本 |
|
||||
| `--nui-text-body` | #22201C | 正文 |
|
||||
| `--nui-text-secondary` | #4A4742 | Subhead、次级 |
|
||||
| `--nui-text-muted` | #6E6A63 | Caption、注释 |
|
||||
| `--nui-text-quote` | #2E2A24 | Quote 主体 |
|
||||
|
||||
## 背景与分隔线 Token
|
||||
|
||||
| Token | 色值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--nui-bg-page` | #F7F4ED | Warm off-white 页面底 |
|
||||
| `--nui-bg-surface` | #FBF9F4 | 次级面板背景 |
|
||||
| `--nui-rule-hairline` | #C9C2B2 | 细线分隔 |
|
||||
| `--nui-rule-decorative` | #1A1A1A | 强调线 |
|
||||
| `--nui-highlight` | #F2E9C8 | 旧报纸黄 |
|
||||
|
||||
## 强调色 Token
|
||||
|
||||
| Token | 色值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--nui-accent-primary` | #7A1F1F | Brick red, Kicker / Masthead 强调 |
|
||||
| `--nui-accent-ink-blue` | #1B2A4A | The Times 蓝 |
|
||||
| `--nui-highlight` | #F2E9C8 | 高亮底色 |
|
||||
|
||||
## 字体家族
|
||||
|
||||
全部经典严肃风字体:Cormorant Garamond 承担报头与展示,Source Serif 4 贯穿正文与标题,Inter 处理 small-caps 元信息。Blackletter preset 通过 UnifrakturMaguntia 切入哥特报头。
|
||||
|
||||
| Token | 字体 | 用途 |
|
||||
|---|---|---|
|
||||
| `--font-family-masthead` | Cormorant Garamond | 报头 |
|
||||
| `--font-family-blackletter` | UnifrakturMaguntia | Blackletter preset |
|
||||
| `--font-family-display` | Source Serif 4 | Display 大字头条 |
|
||||
| `--font-family-headline` | Source Serif 4 | Headline / Subhead |
|
||||
| `--font-family-body` | Source Serif 4 | 正文 |
|
||||
| `--font-family-meta` | Inter | small-caps 元信息 |
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"title": "Theme",
|
||||
"pages": ["index"]
|
||||
}
|
||||
Reference in New Issue
Block a user