跳到正文
册页

网站

Reading - 阅读页面

文章与项目布局、目录、媒体和安装说明。

用法

什么时候用它

构建章节间距一致、导航易于操作的长文阅读页面。

来自@misoto22/folio/website

TSX
import { DetailMasthead } from '@misoto22/folio/website'

实践建议

推荐

  • 提供本地化标签、含义明确的链接和有用的图片替代文本。

避免

  • 不要在展示组件中放入服务凭据、路由逻辑或后端模型。

示例

文章与目录

阅读布局组合了具有语义的发布日期、章节和目录。相邻条目的导航仍是应用提供的普通链接,并保留有意义的标题。

A practice of attention

A few observations from the daily walk.

Published

Notice

A familiar route still changes with the light. Record one detail before naming the whole scene.

Return

Compare what you wrote on the next visit. The difference often matters more than the first impression.

组成部分

在调用处组合,而不是通过 props 配置——所以这个组件没有预料到的布局,依然表达得出来。

ReadingLayout

ReadingLayout props
属性类型默认值说明
outlineReactNode—

同时接受 HTMLAttributes<HTMLDivElement> 里的全部属性,它们会直接透传给底层元素,不再逐条列出。

ReadingSection

seamless 让结构化子内容直接延续章节分隔线,避免重复绘制边线。

ReadingSection props
属性类型默认值说明
captionReactNode—
compactboolean—
leadReactNode—
seamlessboolean—
titleReactNode—

同时接受 Omit<HTMLAttributes<HTMLElement>, 'title'> 里的全部属性,它们会直接透传给底层元素,不再逐条列出。

ReadingLead

ReadingLead props
属性类型默认值说明
children必填ReactNode—
descriptionReactNode—
mutedReactNode—

RecordPager

RecordPager props
属性类型默认值说明
label必填string—
nextReadingPagerItem—
previousReadingPagerItem—

isSelfNumbered

这个组件没有自己的属性。

numberToc

这个组件没有自己的属性。

TableOfContents

TableOfContents props
属性类型默认值说明
items必填OutlineItem[]—
label必填string—
expandedbooleanfalse—
numbering'auto' | 'none''auto'—
onNavigate(id: string) => void—

MobileOutline

MobileOutline props
属性类型默认值说明
closeLabel必填string—
items必填OutlineItem[]—
openLabel必填string—
title必填string—

ReadingProgress

这个组件没有自己的属性。

AuthorPanel

AuthorPanel props
属性类型默认值说明
name必填string—
avatarReactNode—
bioReactNode—
linksReactNode—
roleReactNode—

ReadingFigure

阅读页图片可使用 fit="contain" 保留原始构图,而不裁切成固定比例。

ReadingFigure props
属性类型默认值说明
media必填ReactNode—
captionEndReactNode—
captionStartReactNode—
fit'cover' | 'contain''cover'—
ratiostring'16 / 8'—
width'page' | 'fill''page'—

MediaPlayback

MediaPlayback props
属性类型默认值说明
fallback必填ReactNode—
label必填string—
pauseLabel必填string—
playLabel必填string—
src必填string—
posterstring—

ActionBand

项目末尾的访问入口,突出主要操作,并弱化辅助操作。

ActionBand props
属性类型默认值说明
title必填ReactNode—
actionsReactNode—
descriptionReactNode—
eyebrowReactNode—

FeaturePairs

FeaturePairs props
属性类型默认值说明
items必填{ id?: string; label?: ReactNode; title?: ReactNode; description: ReactNode }[]—

DevicePreview

DevicePreview props
属性类型默认值说明
kind必填'browser' | 'phone'—
media必填ReactNode—
captionReactNode—
labelstring—

PreviewPair

PreviewPair props
属性类型默认值说明
desktop必填ReactNode—
mobileReactNode—

CommandTabs

CommandTabs props
属性类型默认值说明
copiedLabel必填string—
copyLabel必填string—
label必填string—
tabs必填CommandTab[]—
footerReactNode—

ReadingSurface

ReadingSurface props
属性类型默认值说明
numberedboolean—

同时接受 HTMLAttributes<HTMLDivElement> 里的全部属性,它们会直接透传给底层元素,不再逐条列出。

ReadingForm

ReadingForm props
属性类型默认值说明
inlineboolean—

同时接受 React.FormHTMLAttributes<HTMLFormElement> 里的全部属性,它们会直接透传给底层元素,不再逐条列出。

ArchitectureColumns

ArchitectureColumns props
属性类型默认值说明
columns必填{ title: string; connected?: boolean; nodes: ArchitectureColumnNode[] }[]—
foundationArchitectureColumnNode[]—

TokenLine

TokenLine props
属性类型默认值说明
items必填{ label: ReactNode; strong?: boolean; icon?: ReactNode }[]—
labelReactNode—
separatorstring'·'—

ContentFigure

ContentFigure props
属性类型默认值说明
children必填ReactNode—
captionReactNode—
wideboolean—

ReadingPage

ReadingPage props
属性类型默认值说明
children必填ReactNode—

同时接受 HTMLAttributes<HTMLElement> 里的全部属性,它们会直接透传给底层元素,不再逐条列出。

CommandSnippet

CommandSnippet props
属性类型默认值说明
code必填string—
copiedLabel必填string—
copyLabel必填string—
classNamestring—
piecesCommandPiece[]—