import classNames from 'classnames' import React from 'react' import { renderTypeIcon } from './utils/icons' export { default as AttachmentThumbnail } from './Thumbnail' export type { AttachmentThumbnailProps, AttachmentThumbnailVariant, } from './Thumbnail' export type { MediaPlayerProps } from './MediaPlayer' export { renderTypeIcon } from './utils/icons' export { getSourceType, type AttachmentSourceType, type DocumentIconType, } from './utils/mimeType' export interface AttachmentCardProps { variant: 'light' | 'dark' thumbnail: React.ReactNode title?: string placeholderTitle?: string mimeType: string detail?: string statusBadge?: React.ReactNode action?: React.ReactNode topLeft?: React.ReactNode topRight?: React.ReactNode rootRef?: React.Ref 'data-testid'?: string } const AttachmentCard: React.FC = ({ variant, thumbnail, title, placeholderTitle = 'Attachment title', mimeType, detail, statusBadge, action, topLeft, topRight, rootRef, 'data-testid': dataTestId, }) => { const isDark = variant === 'dark' const displayTitle = isDark ? (title ?? placeholderTitle) : (title ?? '') const titleDimmed = isDark && !title return (
{topLeft ? (
{topLeft}
) : null} {topRight ? (
{topRight}
) : null} {thumbnail}
{displayTitle.trim() !== '' && (

{displayTitle}

)}
{renderTypeIcon(mimeType, { className: classNames( 'size-5 shrink-0', isDark ? 'text-white/55' : 'text-black/55' ), weight: 'regular', })} {detail != null && detail !== '' && ( {detail} )} {statusBadge}
{action}
) } export default AttachmentCard