@crystallize/react-image
Advanced tools
Comparing version 3.0.0-beta.7 to 3.0.0-beta.8
@@ -62,6 +62,7 @@ "use strict"; | ||
variants = _restOfAllProps$varia === void 0 ? [] : _restOfAllProps$varia, | ||
alt = restOfAllProps.altText, | ||
altText = restOfAllProps.altText, | ||
className = restOfAllProps.className, | ||
rest = _objectWithoutProperties(restOfAllProps, ["url", "sizes", "variants", "altText", "className"]); | ||
var alt = rest.alt || altText; | ||
var hasVariants = variants.length > 0; // Determine srcSet | ||
@@ -86,5 +87,6 @@ | ||
sizes: sizes, | ||
alt: alt, | ||
className: className | ||
}, rest)); | ||
}, rest, { | ||
alt: alt | ||
})); | ||
} | ||
@@ -94,2 +96,7 @@ | ||
warn("You have provided variants, but not sizes. This has a negative impact on performance. Check out https://crystallize.com/blog/react-image-sizes-attribute-for-fast-ecommerce"); | ||
} // Check alt for null or undefined | ||
if (alt == null) { | ||
warn("Missing alt attribute"); | ||
} | ||
@@ -109,5 +116,6 @@ | ||
src: src, | ||
sizes: sizes, | ||
sizes: sizes | ||
}, rest, { | ||
alt: alt | ||
}, rest))); | ||
}))); | ||
}; | ||
@@ -114,0 +122,0 @@ |
@@ -0,1 +1,8 @@ | ||
## 3.0.0-beta.8 (2019-07-25) | ||
* Updated readme ([29eeaa5](https://github.com/CrystallizeAPI/react-image/commit/29eeaa5)) | ||
* Warn if no alt attr ([2e9b02f](https://github.com/CrystallizeAPI/react-image/commit/2e9b02f)) | ||
## 3.0.0-beta.7 (2019-07-24) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@crystallize/react-image", | ||
"description": "A React package to output an image with different source variations from Crystallize", | ||
"version": "3.0.0-beta.7", | ||
"version": "3.0.0-beta.8", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -32,3 +32,3 @@ ![alt text](https://raw.githubusercontent.com/snowballdigital/react-image/HEAD/media/logo.png "An illustration of an atom") | ||
## Render child | ||
## Render child function | ||
@@ -46,3 +46,3 @@ ``` | ||
> | ||
{({ src, srcSet, srcSetWebp, ...rest }) => { | ||
{({ src, srcSet, srcSetWebp, sizes, ...rest }) => { | ||
// Roll your own render | ||
@@ -56,3 +56,2 @@ return ( | ||
type="image/webp" | ||
sizes={sizes} | ||
/> | ||
@@ -65,7 +64,6 @@ )} | ||
type="image/jpg" | ||
sizes={sizes} | ||
/> | ||
)} | ||
<img src={src} {...rest} /> | ||
<img src={src} sizes={sizes} {...rest} /> | ||
</picture> | ||
@@ -72,0 +70,0 @@ ) |
@@ -34,6 +34,9 @@ import React from "react"; | ||
variants = [], | ||
altText: alt, | ||
altText, | ||
className, | ||
...rest | ||
} = restOfAllProps; | ||
const alt = rest.alt || altText; | ||
const hasVariants = variants.length > 0; | ||
@@ -56,5 +59,5 @@ | ||
sizes, | ||
alt, | ||
className, | ||
...rest | ||
...rest, | ||
alt | ||
}); | ||
@@ -69,2 +72,7 @@ } | ||
// Check alt for null or undefined | ||
if (alt == null) { | ||
warn("Missing alt attribute"); | ||
} | ||
return ( | ||
@@ -79,3 +87,3 @@ <picture className={className}> | ||
<img src={src} sizes={sizes} alt={alt} {...rest} /> | ||
<img src={src} sizes={sizes} {...rest} alt={alt} /> | ||
</picture> | ||
@@ -82,0 +90,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
14614443
50
17564
70