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', () => {
6262 'https://ucarecdn.com/a6f8abc8-f92e-460a-b7a1-c5cd70a18cdb/image.png' ;
6363
6464 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" />
7266 ) ;
7367
7468 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)'
7670 ) ;
7771 } ) ;
7872
@@ -85,7 +79,6 @@ describe('UploadcareImage', () => {
8579 src = { src }
8680 width = { 500 }
8781 height = { 500 }
88- quality = { 80 }
8982 placeholder = "blur"
9083 blurDataURL = { src }
9184 />
Original file line number Diff line number Diff line change @@ -16,18 +16,20 @@ const generateBlurDataUrl = (
1616 return uploadcareLoader ( {
1717 src : src ,
1818 width : blurImageWidth ,
19- quality : 0
19+ quality : 1
2020 } ) ;
2121} ;
2222
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 ;
2725 if ( typeof props . src === 'string' && shouldOverrideBlurDataUrl ( props ) ) {
2826 blurDataURL = generateBlurDataUrl ( props . src , props . width ) ;
2927 }
3028 return (
31- < Image loader = { uploadcareLoader } blurDataURL = { blurDataURL } { ...props } />
29+ < Image
30+ loader = { uploadcareLoader }
31+ blurDataURL = { blurDataURL ?? props . blurDataURL }
32+ { ...props }
33+ />
3234 ) ;
3335}
You can’t perform that action at this time.
0 commit comments