This commit is contained in:
sunzhongyi
2026-05-19 21:09:56 +08:00
commit f3e6b95be9
78 changed files with 10099 additions and 0 deletions
@@ -0,0 +1,251 @@
'use client';
import { Demo } from '@/components/Demo';
import { Layout, Section, Article } from '@newspaperui/components';
import { Headline, BodyText } from '@newspaperui/components';
export default function ResponsivePage() {
return (
<div className="prose prose-lg max-w-none">
<h1></h1>
<p className="text-xl text-gray-600">
NewspaperUI
</p>
<h2></h2>
<p>
NewspaperUI
</p>
<div className="bg-blue-50 border-l-4 border-blue-400 p-4 my-6">
<h3 className="text-lg font-semibold text-blue-900 mt-0"></h3>
<ul className="mb-0 text-blue-800">
<li><strong>1024px</strong>: 24 </li>
<li><strong>768px-1023px</strong>: 16 </li>
<li><strong>&lt;768px</strong>: 12 </li>
</ul>
</div>
<h2></h2>
<p>
</p>
<Demo
title="响应式三栏布局"
description="大屏显示三栏,中屏显示两栏,小屏显示单栏"
code={`<Layout columns={24}>
<Section columns={24}>
{/* 大屏: 8+8+8, 中屏: 12+12, 小屏: 24 */}
<Article span={8} className="lg:span-8 md:span-12 sm:span-24">
<Headline weight="Medium">第一栏</Headline>
<BodyText>内容自动适应屏幕宽度</BodyText>
</Article>
<Article span={8} className="lg:span-8 md:span-12 sm:span-24">
<Headline weight="Medium">第二栏</Headline>
<BodyText>响应式布局</BodyText>
</Article>
<Article span={8} className="lg:span-8 md:span-12 sm:span-24">
<Headline weight="Medium">第三栏</Headline>
<BodyText>自动换行</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
NewspaperUI
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
</p>
<Demo
title="主次内容自适应"
description="大屏 16+8,中屏 12+12,小屏全宽堆叠"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={16}>
<Headline weight="High">主要内容</Headline>
<BodyText weight="High">
主要内容在大屏占据 16 列,在中屏占据 12 列,
在小屏占据全宽。
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Low">侧边栏</Headline>
<BodyText weight="Low">
侧边栏在大屏占据 8 列,在中屏占据 12 列,
在小屏移到主内容下方。
</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={16}>
<Headline weight="High"></Headline>
<BodyText weight="High">
</BodyText>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Low"></Headline>
<BodyText weight="Low">
1<br />
2<br />
3<br />
...
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
NewspaperUI
</p>
<Demo
title="移动优先布局"
description="小屏优化的单栏布局"
>
<Layout columns={24}>
<Section columns={24}>
<Article span={24}>
<Headline weight="High"></Headline>
<BodyText>
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
</p>
<Demo
title="响应式媒体"
description="图片自动适应容器宽度"
>
<Layout columns={24}>
<Section columns={24}>
<Article span={16}>
<Headline weight="High"></Headline>
<div className="bg-gray-200 aspect-video flex items-center justify-center my-4">
<span className="text-gray-600"></span>
</div>
<BodyText>
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<ul>
<li>使remempx</li>
<li></li>
<li> 16px</li>
<li> 44x44px</li>
<li></li>
<li></li>
<li></li>
</ul>
<h2></h2>
<p>
</p>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 my-6">
<div className="border border-gray-200 rounded-lg p-4">
<h3 className="text-lg font-semibold mb-2"></h3>
<ul className="text-sm space-y-1 mb-0">
<li>iPhone SE (375px)</li>
<li>iPhone 12/13 (390px)</li>
<li>iPhone 14 Pro Max (430px)</li>
<li>Android (360px)</li>
</ul>
</div>
<div className="border border-gray-200 rounded-lg p-4">
<h3 className="text-lg font-semibold mb-2"></h3>
<ul className="text-sm space-y-1 mb-0">
<li>iPad Mini (768px)</li>
<li>iPad (810px)</li>
<li>iPad Pro (1024px)</li>
<li>Android (800px)</li>
</ul>
</div>
<div className="border border-gray-200 rounded-lg p-4">
<h3 className="text-lg font-semibold mb-2"></h3>
<ul className="text-sm space-y-1 mb-0">
<li> (1366px)</li>
<li> (1920px)</li>
<li> (2560px)</li>
<li> (3440px)</li>
</ul>
</div>
</div>
<h2></h2>
<p>
使
</p>
<ul>
<li><strong>Chrome DevTools</strong>: Cmd/Ctrl + Shift + M</li>
<li><strong>Firefox</strong>: Cmd/Ctrl + Shift + M</li>
<li><strong>Safari</strong>: Develop Enter Responsive Design Mode</li>
</ul>
<h2></h2>
<ul>
<li>使lazy loading</li>
<li></li>
<li>使WebPAVIF</li>
<li></li>
<li>使 CDN </li>
<li> JavaScript CSS</li>
</ul>
</div>
);
}
@@ -0,0 +1,267 @@
'use client';
import { Demo } from '@/components/Demo';
import { Layout, Section, Article, Layer } from '@newspaperui/components';
import { Headline, Subhead, BodyText, Quote } from '@newspaperui/components';
export default function SpanningPage() {
return (
<div className="prose prose-lg max-w-none">
<h1></h1>
<p className="text-xl text-gray-600">
使 NewspaperUI
</p>
<h2></h2>
<p>
</p>
<Demo
title="报纸头版"
description="主新闻占据 16 列,侧边栏占据 8 列,带浮动拉引"
code={`<Layout columns={24}>
<Section columns={24}>
<div style={{ position: 'relative', minHeight: '600px' }}>
{/* 主新闻 - 16 列 */}
<Article span={16}>
<Headline weight="High">重大新闻标题占据主要版面</Headline>
<Subhead weight="High">
副标题提供更多背景信息和上下文
</Subhead>
<BodyText weight="High">
这是主要新闻的正文内容。在报纸布局中,最重要的新闻通常占据最大的版面,
使用最大的字号和最粗的字重。这样的布局能够立即吸引读者的注意力。
</BodyText>
<BodyText>
新闻的后续段落继续详细描述事件的发展。通过合理的跨栏布局,
我们可以在有限的版面中呈现丰富的内容。
</BodyText>
</Article>
{/* 侧边栏 - 8 列 */}
<Article span={8}>
<Headline weight="Medium">次要新闻</Headline>
<BodyText weight="Medium">
侧边栏的新闻使用较小的字号,适合放置次要但仍然重要的内容。
</BodyText>
</Article>
{/* 浮动拉引 */}
<Layer position="absolute" top="100px" right="20px" zIndex={10}>
<div className="bg-yellow-50 border-l-4 border-yellow-400 p-4 max-w-xs">
<Quote weight="High">
"这是一段重要的引用,用于突出文章中的关键观点"
</Quote>
</div>
</Layer>
</div>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<div style={{ position: 'relative', minHeight: '600px' }}>
<Article span={16}>
<Headline weight="High"></Headline>
<Subhead weight="High">
</Subhead>
<BodyText weight="High">
使
</BodyText>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText weight="Medium">
使
</BodyText>
</Article>
<Layer position="absolute" top="100px" right="20px" zIndex={10}>
<div className="bg-yellow-50 border-l-4 border-yellow-400 p-4 max-w-xs">
<Quote weight="High">
"这是一段重要的引用,用于突出文章中的关键观点"
</Quote>
</div>
</Layer>
</div>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
24 8
</p>
<Demo
title="三栏布局"
description="三个 8 列的文章并排显示"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="Medium">第一栏标题</Headline>
<BodyText>第一栏的内容...</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium">第二栏标题</Headline>
<BodyText>第二栏的内容...</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium">第三栏标题</Headline>
<BodyText>第三栏的内容...</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
</BodyText>
</Article>
<Article span={8}>
<Headline weight="Medium"></Headline>
<BodyText>
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
使
</p>
<Demo
title="12 + 12 列布局"
description="两个等宽的 12 列区域"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={12}>
<Headline weight="High">左侧主要内容</Headline>
<BodyText weight="High">
占据 12 列的主要内容区域...
</BodyText>
</Article>
<Article span={12}>
<Headline weight="High">右侧主要内容</Headline>
<BodyText weight="High">
同样占据 12 列的内容区域...
</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={12}>
<Headline weight="High"></Headline>
<BodyText weight="High">
12
</BodyText>
</Article>
<Article span={12}>
<Headline weight="High"></Headline>
<BodyText weight="High">
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<p>
</p>
<Demo
title="混合列宽布局"
description="6 + 12 + 6 列的组合布局"
code={`<Layout columns={24}>
<Section columns={24}>
<Article span={6}>
<Headline weight="Low">侧边栏</Headline>
<BodyText weight="Low">简短内容</BodyText>
</Article>
<Article span={12}>
<Headline weight="High">主要内容</Headline>
<BodyText>详细的主要内容...</BodyText>
</Article>
<Article span={6}>
<Headline weight="Low">另一侧边栏</Headline>
<BodyText weight="Low">补充信息</BodyText>
</Article>
</Section>
</Layout>`}
>
<Layout columns={24}>
<Section columns={24}>
<Article span={6}>
<Headline weight="Low"></Headline>
<BodyText weight="Low">
1<br />
2<br />
3
</BodyText>
</Article>
<Article span={12}>
<Headline weight="High"></Headline>
<BodyText>
12
6
</BodyText>
</Article>
<Article span={6}>
<Headline weight="Low"></Headline>
<BodyText weight="Low">
1<br />
2<br />
3
</BodyText>
</Article>
</Section>
</Layout>
</Demo>
<h2></h2>
<ul>
<li>使 span 12-16 </li>
<li>使 span 4-8 </li>
<li></li>
<li>使 Layer </li>
<li></li>
<li></li>
</ul>
<h2></h2>
<ul>
<li> Article span Section columns</li>
<li></li>
<li></li>
<li>使 8:166:12:6 </li>
<li></li>
</ul>
</div>
);
}