'use client'; import { Layout, Section, Article, Headline, Subhead, BodyText, } from 'newspaperui-components'; import { Demo } from '@/components/Demo'; import { PropsTable } from '@/components/PropsTable'; export default function GridSystemPage() { return (
栅格系统 24 列由 Layout 提供上下文,Section 在栅格内分配 grid-template-columns, Article 用 grid-column span 跨栏。所有跨栏统一通过 CSS Grid 完成。 24 列可视化

下面的网格演示了 24 列的等宽分布。每个数字标签对应一列。报纸排版偏好 24 列是因为它能整除 2 / 3 / 4 / 6 / 8 / 12,足够灵活地实现 1/3、2/3、1/4、3/4 这类常见栏宽组合。

{Array.from({ length: 24 }, (_, i) => (
{i + 1}
))}
Layout API

Layout 是顶层容器,提供 LayoutContext。Section 通过 useLayout 读取列数上限并自动 clamp。

Section API

Section 是栅格容器, display: grid; grid-template-columns: repeat(N, 1fr) 。子 Article 通过 grid-column span 占位。

Article API

Article 在 Section 栅格内用 grid-column span N 占位。 span 缺省时占满 Section 全宽。

实例
短讯 ...
主稿 ...
`} >
短讯

占 8 列。短讯栏适合放编辑选编、精选事件、快速通读型小段。

主稿

占 16 列。主稿区域承载头版头条、深度报道,可启用 多栏文字流以增强阅读节奏。

); }