mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
fix(console): fix fallback image in image uploader (#3984)
This commit is contained in:
parent
c5770107a0
commit
92f6f9f371
2 changed files with 13 additions and 2 deletions
|
@ -16,7 +16,7 @@
|
|||
bottom: _.unit(2);
|
||||
}
|
||||
|
||||
> img {
|
||||
.image {
|
||||
height: 40px;
|
||||
max-width: 100%;
|
||||
object-fit: contain;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type { AllowedUploadMimeType } from '@logto/schemas';
|
||||
|
||||
import Delete from '@/assets/images/delete.svg';
|
||||
import ImageWithErrorFallback from '@/components/ImageWithErrorFallback';
|
||||
|
||||
import IconButton from '../../IconButton';
|
||||
import FileUploader from '../FileUploader';
|
||||
|
@ -26,7 +27,17 @@ export type Props = Omit<FileUploaderProps, 'maxSize' | 'allowedMimeTypes'> & {
|
|||
function ImageUploader({ name, value, onDelete, ...rest }: Props) {
|
||||
return value ? (
|
||||
<div className={styles.imageUploader}>
|
||||
<img alt={name} src={value} crossOrigin="anonymous" />
|
||||
<ImageWithErrorFallback
|
||||
className={styles.image}
|
||||
src={value}
|
||||
alt={name}
|
||||
/**
|
||||
* Some social connectors like Google will block the references to its image resource,
|
||||
* without specifying the referrerPolicy attribute. Reference:
|
||||
* https://stackoverflow.com/questions/40570117/http403-forbidden-error-when-trying-to-load-img-src-with-google-profile-pic
|
||||
*/
|
||||
referrerPolicy="no-referrer"
|
||||
/>
|
||||
<IconButton
|
||||
className={styles.delete}
|
||||
onClick={() => {
|
||||
|
|
Loading…
Add table
Reference in a new issue