Skip to content

Commit 03eb7f0

Browse files
committed
feat(ListItemFile): Use Thumbnail in ItemIcon
1 parent 82f76f9 commit 03eb7f0

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

react/MuiCozyTheme/ListItem/ListItemFile/ItemIcon.jsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import PropTypes from 'prop-types'
44
import { useClient } from 'cozy-client'
55

66
import Icon from '../../../Icon'
7-
import FileImageLoader from '../../../FileImageLoader'
8-
import CardMedia from '../../../CardMedia'
97
import FiletypeTextIcon from '../../../Icons/FileTypeText'
8+
import FileImageLoader from '../../../FileImageLoader'
9+
import Thumbnail from '../../../Thumbnail'
10+
import Skeleton from '../../../Skeleton'
1011

1112
const ItemIcon = ({ icon, file }) => {
1213
const client = useClient()
@@ -19,9 +20,21 @@ const ItemIcon = ({ icon, file }) => {
1920
file={file}
2021
linkType="tiny"
2122
render={src => {
22-
return <CardMedia component="img" width={32} height={32} image={src} />
23+
return (
24+
<Thumbnail>
25+
{src ? (
26+
<img src={src} alt="" />
27+
) : (
28+
<Skeleton variant="rect" animation="wave" />
29+
)}
30+
</Thumbnail>
31+
)
2332
}}
24-
renderFallback={() => <Icon icon={FiletypeTextIcon} size={32} />}
33+
renderFallback={() => (
34+
<Thumbnail>
35+
<Icon icon={FiletypeTextIcon} />
36+
</Thumbnail>
37+
)}
2538
/>
2639
)
2740
}

0 commit comments

Comments
 (0)