fix(ui): missing thumbnail for non-image files in bulk upload sidebar (#8102)
## Description Uses the `Thumbnail` component used in other places for the bulk upload file rows. Closes #8099 In the future, we should consider adding different thumbnail icons based on the `mimeType` to better describe the files being uploaded. Before:  After:  - [x] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] Existing test suite passes locally with my changes - [ ] I have made corresponding changes to the documentation
This commit is contained in:
@@ -82,12 +82,12 @@
|
||||
background-color: var(--theme-elevation-100);
|
||||
}
|
||||
|
||||
img {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
.thumbnail {
|
||||
width: base(1.2);
|
||||
height: base(1.2);
|
||||
flex-shrink: 0;
|
||||
object-fit: cover;
|
||||
border-radius: var(--style-radius-m);
|
||||
border-radius: var(--style-radius-s);
|
||||
}
|
||||
|
||||
p {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useModal } from '@faceless-ui/modal'
|
||||
import { useWindowInfo } from '@faceless-ui/window-info'
|
||||
import { isImage } from 'payload/shared'
|
||||
import React from 'react'
|
||||
import AnimateHeightImport from 'react-animate-height'
|
||||
|
||||
@@ -13,6 +14,7 @@ import { Drawer } from '../../Drawer/index.js'
|
||||
import { ErrorPill } from '../../ErrorPill/index.js'
|
||||
import { Pill } from '../../Pill/index.js'
|
||||
import { ShimmerEffect } from '../../ShimmerEffect/index.js'
|
||||
import { Thumbnail } from '../../Thumbnail/index.js'
|
||||
import { Actions } from '../ActionsBar/index.js'
|
||||
import { AddFilesView } from '../AddFilesView/index.js'
|
||||
import { useFormsManager } from '../FormsManager/index.js'
|
||||
@@ -144,7 +146,12 @@ export function FileSidebar() {
|
||||
onClick={() => setActiveIndex(index)}
|
||||
type="button"
|
||||
>
|
||||
<img alt={currentFile.name} src={URL.createObjectURL(currentFile)} />
|
||||
<Thumbnail
|
||||
className={`${baseClass}__thumbnail`}
|
||||
fileSrc={
|
||||
isImage(currentFile.type) ? URL.createObjectURL(currentFile) : undefined
|
||||
}
|
||||
/>
|
||||
<div className={`${baseClass}__fileDetails`}>
|
||||
<p className={`${baseClass}__fileName`} title={currentFile.name}>
|
||||
{currentFile.name}
|
||||
|
||||
Reference in New Issue
Block a user