@merchantlabs/gatsby-image-loader
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "@merchantlabs/gatsby-image-loader", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "gatsby-image-loader React component", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
129
README.md
@@ -60,3 +60,19 @@ # @merchantlabs/gatsby-image-loader | ||
``` | ||
## `gatsby-image-loader` props | ||
| Name | Type | Description | | ||
| ----------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | | ||
| `resolutions` | `object` | Data returned from the `resolutions` query | | ||
| `sizes` | `object` | Data returned from the `sizes` query | | ||
| `title` | `string` | Passed to the underlying hidden `img` element | | ||
| `alt` | `string` | Passed to the underlying hidden `img` element | | ||
| `onLoad` | `func` | A callback that is called when the full-size image has loaded. | | ||
| `children` | `func` | Function that receives `src` and `imgLoaded` as props and returns a React component | | ||
---------------- | ||
**Everything below here is copied directly from the [`gatsby-image` docs](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-image) without modification.** | ||
---------------- | ||
## Two types of responsive images | ||
@@ -84,2 +100,53 @@ | ||
## "Resolutions" queries | ||
### Component | ||
Pass in the data returned from the `resolutions` object in your query via the | ||
`resolutions` prop. e.g. `<ImageLoader resolutions={resolutions}> {({ src }) => {...}} </ImageLoader>` | ||
### Query | ||
```graphql | ||
{ | ||
imageSharp { | ||
# Other options include height (set both width and height to crop), | ||
# grayscale, duotone, rotate, etc. | ||
resolutions(width: 400) { | ||
# Choose either the fragment including a small base64ed image, a traced placeholder SVG, or one without. | ||
...GatsbyImageSharpResolutions | ||
} | ||
} | ||
} | ||
``` | ||
## "Sizes" queries | ||
### Component | ||
Pass in the data returned from the `sizes` object in your query via the `sizes` | ||
prop. e.g. `<ImageLoader sizes={sizes}> {({ src }) => {...}} </ImageLoader>` | ||
### Query | ||
```graphql | ||
{ | ||
imageSharp { | ||
# i.e. the max width of your container is 700 pixels. | ||
# | ||
# Other options include maxHeight (set both maxWidth and maxHeight to crop), | ||
# grayscale, duotone, rotate, etc. | ||
sizes(maxWidth: 700) { | ||
# Choose either the fragment including a small base64ed image, a traced placeholder SVG, or one without. | ||
...GatsbyImageSharpSizes_noBase64 | ||
} | ||
} | ||
} | ||
``` | ||
## Image processing arguments | ||
[gatsby-plugin-sharp](/packages/gatsby-plugin-sharp) supports many additional arguments for transforming your images like | ||
`quality`,`sizeByPixelDensity`,`pngCompressionLevel`,`cropFocus`,`greyscale` and many more. See its documentation for more. | ||
## Fragments | ||
@@ -147,63 +214,1 @@ | ||
options._ | ||
## "Resolutions" queries | ||
### Component | ||
Pass in the data returned from the `resolutions` object in your query via the | ||
`resolutions` prop. e.g. `<ImageLoader resolutions={resolutions}> {({ src }) => {...}} </ImageLoader>` | ||
### Query | ||
```graphql | ||
{ | ||
imageSharp { | ||
# Other options include height (set both width and height to crop), | ||
# grayscale, duotone, rotate, etc. | ||
resolutions(width: 400) { | ||
# Choose either the fragment including a small base64ed image, a traced placeholder SVG, or one without. | ||
...GatsbyImageSharpResolutions | ||
} | ||
} | ||
} | ||
``` | ||
## "Sizes" queries | ||
### Component | ||
Pass in the data returned from the `sizes` object in your query via the `sizes` | ||
prop. e.g. `<ImageLoader sizes={sizes}> {({ src }) => {...}} </ImageLoader>` | ||
### Query | ||
```graphql | ||
{ | ||
imageSharp { | ||
# i.e. the max width of your container is 700 pixels. | ||
# | ||
# Other options include maxHeight (set both maxWidth and maxHeight to crop), | ||
# grayscale, duotone, rotate, etc. | ||
sizes(maxWidth: 700) { | ||
# Choose either the fragment including a small base64ed image, a traced placeholder SVG, or one without. | ||
...GatsbyImageSharpSizes_noBase64 | ||
} | ||
} | ||
} | ||
``` | ||
## `gatsby-image-loader` props | ||
| Name | Type | Description | | ||
| ----------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | | ||
| `resolutions` | `object` | Data returned from the `resolutions` query | | ||
| `sizes` | `object` | Data returned from the `sizes` query | | ||
| `title` | `string` | Passed to the underlying hidden `img` element | | ||
| `alt` | `string` | Passed to the underlying hidden `img` element | | ||
| `onLoad` | `func` | A callback that is called when the full-size image has loaded. | | ||
| `children` | `func` | Function that receives `src` and `imgLoaded` as props and returns a React component | | ||
## Image processing arguments | ||
[gatsby-plugin-sharp](/packages/gatsby-plugin-sharp) supports many additional arguments for transforming your images like | ||
`quality`,`sizeByPixelDensity`,`pngCompressionLevel`,`cropFocus`,`greyscale` and many more. See its documentation for more. |
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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
212
1
9337
2
0
2