diff --git a/packages/web-react/src/components/FileUploader/AttachmentImagePreview.tsx b/packages/web-react/src/components/FileUploader/AttachmentImagePreview.tsx index 919150aa41..f69312c869 100644 --- a/packages/web-react/src/components/FileUploader/AttachmentImagePreview.tsx +++ b/packages/web-react/src/components/FileUploader/AttachmentImagePreview.tsx @@ -7,21 +7,29 @@ type AttachmentImagePreviewProps = { imagePreview: string; label: string; meta?: FileMetadata; + objectFit?: 'contain' | 'cover'; }; -const AttachmentImagePreview = ({ label, imagePreview, meta }: AttachmentImagePreviewProps) => { - const { classProps } = useFileUploaderStyleProps({ meta }); - const { imageCropStyles } = classProps; +const AttachmentImagePreview = ({ label, imagePreview, meta, objectFit }: AttachmentImagePreviewProps) => { + const { classProps } = useFileUploaderStyleProps({ meta, objectFit }); + const { imageCropStyles, attachmentStyles } = classProps; return ( - {label} + {label} ); }; AttachmentImagePreview.defaultProps = { meta: undefined, + objectFit: 'contain', }; export default AttachmentImagePreview; diff --git a/packages/web-react/src/components/FileUploader/FileUploaderAttachment.tsx b/packages/web-react/src/components/FileUploader/FileUploaderAttachment.tsx index 4996905982..faeaaea671 100644 --- a/packages/web-react/src/components/FileUploader/FileUploaderAttachment.tsx +++ b/packages/web-react/src/components/FileUploader/FileUploaderAttachment.tsx @@ -23,12 +23,13 @@ const FileUploaderAttachment = (props: SpiritFileUploaderAttachmentProps) => { iconName = DEFAULT_ICON_NAME, id, label, + meta, name, + objectFit, onDismiss, onEdit, onError, removeText, - meta, ...restProps } = props; const [imagePreview, setImagePreview] = useState(''); @@ -83,7 +84,7 @@ const FileUploaderAttachment = (props: SpiritFileUploaderAttachmentProps) => { className={classNames(classProps.attachment.root, styleProps.className)} > {hasImagePreview && imagePreview ? ( - + ) : (