Skip to content

Commit a2a7a14

Browse files
committed
Fix Element type is invalid in n FileAttachment file
1 parent 1b4bedb commit a2a7a14

File tree

2 files changed

+56
-54
lines changed

2 files changed

+56
-54
lines changed

src/FileAttachment.tsx

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,60 +35,62 @@ function FileAttachment(props: FileAttachmentProps) {
3535
}
3636

3737
return (
38-
<Box
39-
sx={{
40-
mb: 0,
41-
display: 'flex',
42-
alignItems: 'center',
43-
'&:nth-of-type(even)': {
44-
backgroundColor: theme.palette.action.hover
45-
}
46-
}}
47-
>
48-
<Box sx={{ display: 'flex', flexGrow: 1, alignItems: 'center' }}>
49-
<Avatar
50-
alt=""
51-
src={file.path}
52-
ref={avatarRef}
53-
variant="rounded"
54-
sx={{
55-
m: .5,
56-
width: 32,
57-
height: 32,
58-
display: 'flex',
59-
background: 'transparent'
60-
}}
61-
>
62-
{icon}
63-
</Avatar>
64-
<Typography
65-
component="div"
66-
sx={{ display: 'inline-grid', alignItems: 'center' }}
67-
>
68-
<Typography variant="body2" noWrap>
69-
{file.name}
70-
</Typography>
71-
<Typography variant="caption" noWrap>
72-
<React.Fragment>
38+
<>
39+
<Box
40+
sx={{
41+
mb: 0,
42+
display: 'flex',
43+
alignItems: 'center',
44+
'&:nth-of-type(even)': {
45+
backgroundColor: theme.palette.action.hover
46+
}
47+
}}
48+
>
49+
<Box sx={{ display: 'flex', flexGrow: 1, alignItems: 'center' }}>
50+
<Avatar
51+
alt=""
52+
src={file.path}
53+
ref={avatarRef}
54+
variant="rounded"
55+
sx={{
56+
m: .5,
57+
width: 32,
58+
height: 32,
59+
display: 'flex',
60+
background: 'transparent'
61+
}}
62+
>
63+
{icon}
64+
</Avatar>
65+
<Typography
66+
component="div"
67+
sx={{ display: 'inline-grid', alignItems: 'center' }}
68+
>
69+
<Typography variant="body2" noWrap>
70+
{file.name}
71+
</Typography>
72+
<Typography variant="caption" noWrap>
73+
<React.Fragment>
7374

74-
<b
75-
// eslint-disable-next-line
76-
// @ts-ignore
77-
>{size}</b> | <b>{file?.extension ? file.extension.toLowerCase() : ''}</b>
78-
</React.Fragment>
75+
<b
76+
// eslint-disable-next-line
77+
// @ts-ignore
78+
>{size}</b> | <b>{file?.extension ? file.extension.toLowerCase() : ''}</b>
79+
</React.Fragment>
80+
</Typography>
7981
</Typography>
82+
</Box>
83+
84+
<Typography component="div" sx={{ mr: -.5, textAlign: 'right' }}>
85+
<IconButton
86+
disabled={disabled}
87+
onClick={(event): void => handleRemoveFile(event, index)}
88+
>
89+
<CloseIcon />
90+
</IconButton>
8091
</Typography>
8192
</Box>
82-
83-
<Typography component="div" sx={{ mr: -.5, textAlign: 'right' }}>
84-
<IconButton
85-
disabled={disabled}
86-
onClick={(event): void => handleRemoveFile(event, index)}
87-
>
88-
<CloseIcon />
89-
</IconButton>
90-
</Typography>
91-
</Box>
93+
</>
9294
)
9395
}
9496

src/FileUpload.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import {
1717
useMediaQuery,
1818
TypographyProps, PaperProps,
1919
} from '@mui/material'
20-
// eslint-disable-next-line
21-
// @ts-ignore
22-
import FileAttachment from "./FileAttachment.tsx"
2320
import { useTheme, styled } from '@mui/material/styles'
2421
// eslint-disable-next-line
2522
// @ts-ignore
2623
import uploadImage from '../public/Files And Folder_Two Color_2.svg'
24+
// eslint-disable-next-line
25+
// @ts-ignore
26+
import FileAttachment from "./FileAttachment.tsx"
2727
import {
2828
ExtendedFileProps,
2929
FileActionProps,
@@ -639,7 +639,7 @@ FileUpload.defaultProps = {
639639
containerProps: {},
640640
ContainerProps: {},
641641
LabelsGridProps: {},
642-
PlaceholderGridProps: '',
642+
PlaceholderGridProps: {},
643643
} as Partial<PaperProps>
644644

645645
export default FileUpload

0 commit comments

Comments
 (0)