import type { ReactNode } from 'react'; import { PlatformMediaFrame } from './PlatformMediaFrame'; type PlatformMediaTileGridColumns = 'five' | 'six'; type PlatformMediaTileGridGap = 'xs' | 'sm'; type PlatformMediaTileGridAspect = 'auto' | 'square'; type PlatformMediaTileSurface = 'white' | 'slate' | 'bare'; type PlatformMediaTileGridSurface = 'none' | 'soft'; export type PlatformMediaTileGridItem = { id: string; src?: string | null; alt?: string; refreshKey?: string | number | null; fallbackLabel?: string; fallbackContent?: ReactNode; testId?: string; className?: string; imageClassName?: string; fallbackClassName?: string; }; type PlatformMediaTileGridProps = { items: PlatformMediaTileGridItem[]; columns?: PlatformMediaTileGridColumns; gap?: PlatformMediaTileGridGap; aspect?: PlatformMediaTileGridAspect; surface?: PlatformMediaTileGridSurface; tileSurface?: PlatformMediaTileSurface; fallbackLabel?: string; imageClassName?: string; fallbackClassName?: string; className?: string; tileClassName?: string; }; const PLATFORM_MEDIA_TILE_GRID_COLUMNS_CLASS: Record< PlatformMediaTileGridColumns, string > = { five: 'grid-cols-5', six: 'grid-cols-6', }; const PLATFORM_MEDIA_TILE_GRID_GAP_CLASS: Record< PlatformMediaTileGridGap, string > = { sm: 'gap-1.5', xs: 'gap-1', }; const PLATFORM_MEDIA_TILE_GRID_SURFACE_CLASS: Record< PlatformMediaTileGridSurface, string > = { none: '', soft: 'bg-white/78 p-2', }; const PLATFORM_MEDIA_TILE_SURFACE_CLASS: Record< PlatformMediaTileSurface, string > = { bare: 'border border-white/80', slate: 'border border-white/80 bg-slate-50', white: 'border border-white/80 bg-white shadow-sm', }; /** * 平台媒体缩略格网格。 * 统一承接结果页里同尺寸素材 tile 的网格、圆角、边框和图片/fallback 框。 */ export function PlatformMediaTileGrid({ items, columns = 'six', gap = 'sm', aspect = 'auto', surface = 'none', tileSurface = 'white', fallbackLabel = '素材', imageClassName = 'h-full w-full object-cover', fallbackClassName = 'tracking-normal text-[var(--platform-text-soft)]', className, tileClassName, }: PlatformMediaTileGridProps) { return (
{items.map((item) => ( ))}
); }