import { FC, WebCellProps } from 'web-cell'; import { Icon } from '../Reminder'; import { ImageProps } from './Image'; import { ImagePreview } from './ImagePreview'; export type FilePreviewProps = ImageProps & WebCellProps & WebCellProps & WebCellProps & { type?: HTMLInputElement['accept']; path: string; }; export const FileTypeMap = { stream: 'binary', compressed: 'zip', msword: 'doc', document: 'docx', powerpoint: 'ppt', presentation: 'pptx', excel: 'xls', sheet: 'xlsx' }; export const FilePreview: FC = ({ className = '', type, path, ...props }) => { const [category, ...kind] = type?.split(/\W+/) || [], fileName = new URL(path, 'http://localhost').pathname.split('/').at(-1); const extension = FileTypeMap[kind.at(-1)] || (fileName?.includes('.') ? fileName.split('.').at(-1) : kind.at(-1)); return category === 'image' ? ( ) : category === 'audio' ? (