'use client'; import React, { ReactNode, CSSProperties } from 'react'; import { clampSpan, cx } from '@newspaperui/utils'; import { useSection } from './Section'; export interface ArticleProps { span?: number; breakable?: boolean; className?: string; style?: CSSProperties; children: ReactNode; } /** * Article — 文章块,grid-column span 跨栏 * * - 通过 span 属性控制在 Section 栅格中占据的列数 * - 自动 clamp 到父 Section 的最大列数 * - 支持 print 分页控制(breakable) * * @example *
* Breaking News * ... *
*/ export const Article: React.FC = ({ span, breakable = true, className, style, children, }) => { const section = useSection(); const cols = span ? clampSpan(span, section.columns) : section.columns; return (
{children}
); };