File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -62,17 +62,11 @@ describe('UploadcareImage', () => {
62
62
'https://ucarecdn.com/a6f8abc8-f92e-460a-b7a1-c5cd70a18cdb/image.png' ;
63
63
64
64
render (
65
- < UploadcareImage
66
- src = { src }
67
- width = { 500 }
68
- height = { 500 }
69
- quality = { 80 }
70
- placeholder = "blur"
71
- />
65
+ < UploadcareImage src = { src } width = { 500 } height = { 500 } placeholder = "blur" />
72
66
) ;
73
67
74
68
expect ( screen . getByRole ( 'img' ) ) . toHaveStyle (
75
- 'background-image: url(https://ucarecdn.com/a6f8abc8-f92e-460a-b7a1-c5cd70a18cdb/-/format/auto/-/stretch/off/-/progressive/yes/-/resize/10x /-/quality/lightest/image.png)'
69
+ 'background-image: url(https://ucarecdn.com/a6f8abc8-f92e-460a-b7a1-c5cd70a18cdb/-/format/auto/-/stretch/off/-/progressive/yes/-/resize/5x /-/quality/lightest/image.png)'
76
70
) ;
77
71
} ) ;
78
72
@@ -85,7 +79,6 @@ describe('UploadcareImage', () => {
85
79
src = { src }
86
80
width = { 500 }
87
81
height = { 500 }
88
- quality = { 80 }
89
82
placeholder = "blur"
90
83
blurDataURL = { src }
91
84
/>
Original file line number Diff line number Diff line change @@ -16,18 +16,20 @@ const generateBlurDataUrl = (
16
16
return uploadcareLoader ( {
17
17
src : src ,
18
18
width : blurImageWidth ,
19
- quality : 0
19
+ quality : 1
20
20
} ) ;
21
21
} ;
22
22
23
- export function UploadcareImage ( {
24
- blurDataURL,
25
- ...props
26
- } : ImageProps ) : JSX . Element {
23
+ export function UploadcareImage ( props : ImageProps ) : JSX . Element {
24
+ let blurDataURL : string | undefined ;
27
25
if ( typeof props . src === 'string' && shouldOverrideBlurDataUrl ( props ) ) {
28
26
blurDataURL = generateBlurDataUrl ( props . src , props . width ) ;
29
27
}
30
28
return (
31
- < Image loader = { uploadcareLoader } blurDataURL = { blurDataURL } { ...props } />
29
+ < Image
30
+ loader = { uploadcareLoader }
31
+ blurDataURL = { blurDataURL ?? props . blurDataURL }
32
+ { ...props }
33
+ />
32
34
) ;
33
35
}
You can’t perform that action at this time.
0 commit comments