@nish1896/rhf-mui-components
Version:
A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms
12 lines (11 loc) • 770 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Box from '@mui/material/Box';
import IconButton from '@mui/material/IconButton';
import Typography from '@mui/material/Typography';
import DeleteIcon from '@mui/icons-material/Delete';
import { getFileSize } from '../../../utils';
const FileItem = ({ index, file, showFileSize, removeFile }) => {
const fileText = `${file.name} ${showFileSize ? `(${getFileSize(file.size)})` : ''}`;
return (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsx(Typography, { children: fileText.trim() }), _jsx(IconButton, { size: "small", onClick: () => removeFile(index), children: _jsx(DeleteIcon, { fontSize: "small" }) })] }));
};
export default FileItem;