'use client'; import React, { ReactNode, CSSProperties } from 'react'; import { visualWeights, resolveFontSize } from '@newspaperui/theme'; import { cx } from '@newspaperui/utils'; export interface CaptionProps { credit?: string; // e.g. "Photograph by Jane Doe" className?: string; style?: CSSProperties; children: ReactNode; } /** * Caption — 图片说明(italic + credit small-caps) * * - 主体文字为 italic 衬线,描述图片内容 * - credit 部分以 small-caps 显示摄影师/来源信息 * - 渲染为 figcaption,语义化配合 Figure 使用 * * @example * * A view of the city skyline at sunset. * */ export const Caption: React.FC = ({ credit, className, style, children }) => { const config = visualWeights.Caption.Standard!; return (
{children} {credit && ( {credit} )}
); };