import React, { useState } from 'react'; import { SilkeButton } from '../silke-button'; import { SilkeIcon } from '../silke-icon/silke-icon'; import { SilkePopover } from '../silke-popover/silke-popover'; import { getFileIcon, truncateFilename } from './file-utils'; import { imageValueToDataUrl } from './image-utils'; import styles from './silke-command-text-field.module.scss'; import { isImage, SilkeFileValue, SilkeImageValue } from './utils'; interface AttachmentChipProps { attachment: SilkeImageValue | SilkeFileValue; disabled?: boolean; onRemove?: () => void; } export function AttachmentChip({ attachment, disabled, onRemove }: AttachmentChipProps) { const name = isImage(attachment) ? attachment.name || 'Image' : attachment.name; const [showPreview, setShowPreview] = useState(false); return (