Files
newsui/packages/docs/app/(docs)/components/rule/page.tsx
T

135 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-05-20 01:30:49 +08:00
'use client';
import {
Layout,
Section,
Article,
Headline,
Subhead,
BodyText,
Rule,
} from 'newspaperui-components';
2026-05-20 01:30:49 +08:00
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
export default function RulePage() {
return (
<Layout columns={24} maxWidth="900px" padding="2rem">
<Section columns={24}>
<Article span={24}>
<Headline weight="Medium" as="h1">
Rule 线
</Headline>
<Subhead weight="Medium">
线 variant hairlinedoublethick
</Subhead>
<Headline weight="Low" as="h2">
API
</Headline>
<PropsTable
data={[
{
name: 'variant',
type: "'hairline' | 'double' | 'thick'",
default: "'hairline'",
description: '线型。',
},
{
name: 'orientation',
type: "'horizontal' | 'vertical'",
default: "'horizontal'",
description: '方向。',
},
{
name: 'span',
type: 'number',
description: '横向时占多少列。缺省时 1 / -1 全跨。',
},
{
name: 'className',
type: 'string',
description: '自定义 CSS 类名。',
},
{
name: 'style',
type: 'CSSProperties',
description: '自定义内联样式。',
},
]}
/>
<Headline weight="Low" as="h2">
variant
</Headline>
<Demo title="hairline / double / thick" description="水平分隔线对照。">
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}>
<div>
<BodyText weight="Low">
<p>hairline</p>
</BodyText>
<Rule variant="hairline" />
</div>
<div>
<BodyText weight="Low">
<p>double</p>
</BodyText>
<Rule variant="double" />
</div>
<div>
<BodyText weight="Low">
<p>thick</p>
</BodyText>
<Rule variant="thick" />
</div>
</div>
</Demo>
<Headline weight="Low" as="h2">
</Headline>
<Demo
title="垂直分隔线"
description="在两栏之间放置垂直 Rule。"
code={`<div style={{ display: 'flex', gap: '1.5rem', height: '120px' }}>
<div>左栏内容</div>
<Rule variant="hairline" orientation="vertical" />
<div>右栏内容</div>
</div>`}
>
<div style={{ display: 'flex', gap: '1.5rem', height: '120px', alignItems: 'stretch' }}>
<div style={{ flex: 1 }}>
<BodyText weight="Low">
<p>
Markets responded cautiously through the morning session. The pound
traded sideways against the dollar.
</p>
</BodyText>
</div>
<Rule variant="hairline" orientation="vertical" />
<div style={{ flex: 1 }}>
<BodyText weight="Low">
<p>
Analysts at three of the City&rsquo;s largest houses framed the move as
a holding pattern.
</p>
</BodyText>
</div>
</div>
</Demo>
<Headline weight="Low" as="h2">
使
</Headline>
<BodyText weight="Low">
<p>
Rule Section <code>gridColumn: 1 / -1</code>
<code>span</code> prop Rule
flex
</p>
</BodyText>
</Article>
</Section>
</Layout>
);
}