Skip to content

Commit

Permalink
fix(upload): 上传组件图片展示样式优化 (#3290)
Browse files Browse the repository at this point in the history
* fix(upload): 上传组件图片展示样式优化

* chore: update snapshot

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
huangchen1031 and github-actions[bot] authored Dec 20, 2024
1 parent 02d14d0 commit a2e730d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
class="t-image__wrapper t-image__wrapper--shape-square t-upload__card-image"
>
<img
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src=""
/>
<div
Expand Down Expand Up @@ -958,7 +958,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
class="t-image__wrapper t-image__wrapper--shape-square t-upload__card-image"
>
<img
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://img1.txt"
/>
<div
Expand Down Expand Up @@ -1060,7 +1060,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
class="t-image__wrapper t-image__wrapper--shape-square t-upload__card-image"
>
<img
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://img2.txt"
/>
<div
Expand Down
8 changes: 7 additions & 1 deletion src/upload/themes/ImageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ const ImageCard = (props: ImageCardUploadProps) => {

const renderMainContent = (file: UploadFile, index: number) => (
<div className={`${classPrefix}-upload__card-content ${classPrefix}-upload__card-box`}>
<Image className={`${classPrefix}-upload__card-image`} src={file.url || file.raw} error="" loading="" />
<Image
className={`${classPrefix}-upload__card-image`}
fit="contain"
src={file.url || file.raw}
error=""
loading=""
/>
<div className={`${classPrefix}-upload__card-mask`}>
<span className={`${classPrefix}-upload__card-mask-item`} onClick={(e) => e.stopPropagation()}>
<ImageViewer
Expand Down
8 changes: 7 additions & 1 deletion src/upload/themes/MultipleFlowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ const ImageFlowList = (props: ImageFlowListProps) => {
</div>
)}
{(['waiting', 'success'].includes(file.status) || (!file.status && file.url)) && (
<Image className={`${uploadPrefix}__card-image`} src={file.url || file.raw} error="" loading="" />
<Image
className={`${uploadPrefix}__card-image`}
fit="contain"
src={file.url || file.raw}
error=""
loading=""
/>
)}
<div className={`${uploadPrefix}__card-mask`}>
{(file.url || file.raw) && !['progress', 'fail'].includes(file.status) && (
Expand Down
18 changes: 9 additions & 9 deletions test/snap/__snapshots__/csr.test.jsx.snap

Large diffs are not rendered by default.

Loading

0 comments on commit a2e730d

Please sign in to comment.