import React from 'react'; import { m, AnimatePresence } from 'framer-motion'; import { fileData } from '@seliseblocks/next-images/libs'; import { varFade } from '@seliseblocks/next-animations/libs'; import { Iconify, FileThumbnail } from '@seliseblocks/next-images'; import Stack from '@mui/material/Stack'; import { alpha } from '@mui/material/styles'; import IconButton from '@mui/material/IconButton'; import ListItemText from '@mui/material/ListItemText'; import { fData } from '../libs'; import { IUploadProps } from '../types'; /** * @description MultiFilePreview - component * @param {IUploadProps} props - The props of the multi file preview * @return {React.ReactNode} component - The multi file preview */ export const MultiFilePreview = ({ thumbnail, files, onRemove, sx }: IUploadProps) => ( {files?.map((file) => { const { key, name = '', size = 0 } = fileData(file); const isNotFormatFile = typeof file === 'string'; if (thumbnail) { return ( `solid 1px ${alpha(theme.palette.grey[500], 0.16)}`, ...sx, }} > {onRemove && ( onRemove(file)} sx={{ p: 0.5, top: 4, right: 4, position: 'absolute', color: 'common.white', bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48), '&:hover': { bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72), }, }} > )} ); } return ( `solid 1px ${alpha(theme.palette.grey[500], 0.16)}`, ...sx, }} > {onRemove && ( onRemove(file)}> )} ); })} );