Files
newsui/packages/docs/app/components/article/page.tsx
T

193 lines
6.7 KiB
TypeScript
Raw Normal View History

2026-05-19 21:09:56 +08:00
'use client';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
import { Layout, Section, Article, Headline, BodyText, Subhead } from '@newspaperui/components';
export default function ArticlePage() {
return (
<div className="prose prose-lg max-w-none">
<h1>Article </h1>
<p className="text-xl text-gray-600">
Article
</p>
<h2></h2>
<p>
<code>Article</code>
span
</p>
<h2>API </h2>
<PropsTable
data={[
{
name: 'span',
type: 'number',
required: true,
description: '文章占据的列数,必须 ≤ 所在 Section 的 columns',
},
{
name: 'priority',
type: 'number',
default: '0',
description: '优先级,数值越大优先级越高,影响排序',
},
{
name: 'weight',
type: '"High" | "Medium" | "Low"',
default: '"Medium"',
description: '视觉权重,影响内部文本组件的默认样式',
},
{
name: 'breakable',
type: 'boolean',
default: 'true',
description: '是否允许在此处分页断开',
},
{
name: 'className',
type: 'string',
description: '自定义 CSS 类名',
},
{
name: 'children',
type: 'React.ReactNode',
required: true,
description: '文章内容',
},
]}
/>
<h2></h2>
<Demo
title="单列文章"
description="创建一个占据 8 列的文章"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="High">文章标题</Headline>
<Subhead>副标题说明</Subhead>
<BodyText>
这是文章的正文内容。Article 组件提供了内容容器,
可以包含多种文本和媒体组件。
</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="High"></Headline>
<Subhead></Subhead>
<BodyText>
Article
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
span span
span
</p>
<Demo
title="多列文章并排"
description="在 24 列布局中创建三个 8 列的文章"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="High">主要文章</Headline>
<BodyText>占据 8 列的主要内容</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium">次要文章</Headline>
<BodyText>占据 8 列的次要内容</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium">更多内容</Headline>
<BodyText>占据 8 列的更多内容</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="High"></Headline>
<BodyText> 8 使 High </BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText> 8 使 Medium </BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText> 8 </BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<Demo
title="混合宽度布局"
description="组合不同宽度的文章实现复杂布局"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={16}>
<Headline weight="High">宽文章 (16 列)</Headline>
<BodyText>
这是一篇占据 16 列的宽文章,适合放置重要内容或长篇文章。
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Low">窄文章 (8 列)</Headline>
<BodyText>这是占据 8 列的窄文章,适合侧边栏或简短内容。</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={16}>
<Headline weight="High"> (16 )</Headline>
<BodyText>
16
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Low"> (8 )</Headline>
<BodyText> 8 </BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2>使</h2>
<ul>
<li>使 12-16 </li>
<li>使 6-8 </li>
<li> Section Article span Section.columns</li>
<li>使 priority </li>
<li> weight </li>
<li>使 span </li>
</ul>
<h2></h2>
<ul>
<li>Article span Section columns </li>
<li> Section Article span Section.columns</li>
<li>Article </li>
<li>breakable </li>
</ul>
</div>
);
}