-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #900 from dc7290/main
Release
- Loading branch information
Showing
17 changed files
with
717 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,7 @@ picture.d.ts | |
image.js | ||
image.d.ts | ||
legacy | ||
remote-image.js | ||
remote-image.d.ts | ||
remote-picture.js | ||
remote-picture.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
description: This page introduces the RemoteImage component for remote images. | ||
--- | ||
|
||
# RemoteImage component | ||
|
||
If you want to use remote images (external images) in this library, you need to manually write the external image URL in the configuration file or use the `RemoteImage` component. | ||
In other words, using the `RemoteImage` component eliminates the need to manually write the image URL in the configuration file. | ||
|
||
## Usage | ||
|
||
```tsx | ||
import RemoteImage from 'next-export-optimize-images/remote-image' | ||
|
||
function Component() { | ||
return ( | ||
<> | ||
<RemoteImage src="https://example.com/image01.jpg" alt="" /> | ||
{/* | ||
Or use dynamic values with variables | ||
const id = 'image01' | ||
<RemoteImage src={`https://example.com/${id}.jpg`} alt="" /> | ||
*/} | ||
</> | ||
) | ||
} | ||
``` | ||
|
||
or Picture tag. | ||
(webp support is added by default) | ||
|
||
```tsx | ||
import RemotePicture from 'next-export-optimize-images/remote-picture' | ||
|
||
function Component() { | ||
return ( | ||
<> | ||
<RemotePicture src="https://example.com/image01.jpg" alt="" /> | ||
{/* | ||
Or use dynamic values with variables | ||
const id = 'image01' | ||
<RemotePicture src={`https://example.com/${id}.jpg`} alt="" /> | ||
*/} | ||
</> | ||
) | ||
} | ||
``` | ||
|
||
## Definition | ||
|
||
- props: `Omit<ImageProps, 'src'> & { src: string }` | ||
- return: `JSX.Element` | ||
|
||
※ ImageProps is the same as the props of the Image component provided by next/image. | ||
|
||
## Tips | ||
|
||
### Use with `remoteImages`. | ||
|
||
```js title="export-images.config.js" | ||
/** | ||
* @type {import('next-export-optimize-images').Config} | ||
*/ | ||
const config = { | ||
remoteImages: ['https://example.com/image01.jpg', 'https://example.com/image02.jpg'], | ||
} | ||
|
||
module.exports = config | ||
``` | ||
|
||
```tsx | ||
import Image from 'next-export-optimize-images/image' | ||
import RemoteImage from 'next-export-optimize-images/remote-image' | ||
|
||
function Component() { | ||
return ( | ||
<> | ||
<Image src="https://example.com/image01.jpg" alt="" /> | ||
<Image src="https://example.com/image02.jpg" alt="" /> | ||
<RemoteImage src="https://example.com/image03.jpg" alt="" /> | ||
</> | ||
) | ||
} | ||
``` | ||
|
||
'image01.jpg', 'image02.jpg' and 'image03.jpg' are downloaded locally and optimized. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3935,10 +3935,10 @@ clone-response@^1.0.2: | |
dependencies: | ||
mimic-response "^1.0.0" | ||
|
||
[email protected].0: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb" | ||
integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg== | ||
[email protected].1: | ||
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999" | ||
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== | ||
|
||
clsx@^1.2.1: | ||
version "1.2.1" | ||
|
@@ -7139,10 +7139,10 @@ prepend-http@^2.0.0: | |
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" | ||
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= | ||
|
||
[email protected].13: | ||
version "0.5.13" | ||
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.13.tgz#ee3c1e07848c90abdd1edde36a09366327e31e26" | ||
integrity sha512-2tPWHCFNC+WRjAC4SIWQNSOdcL1NNkydXim8w7TDqlZi+/ulZYz2OouAI6qMtkggnPt7lGamboj6LcTMwcCvoQ== | ||
[email protected].14: | ||
version "0.5.14" | ||
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.14.tgz#4482eed357d5e22eac259541c70aca5a4c7b9d5c" | ||
integrity sha512-Puaz+wPUAhFp8Lo9HuciYKM2Y2XExESjeT+9NQoVFXZsPPnc9VYss2SpxdQ6vbatmt8/4+SN0oe0I1cPDABg9Q== | ||
|
||
[email protected]: | ||
version "3.2.5" | ||
|
@@ -7342,13 +7342,13 @@ react-dev-utils@^12.0.1: | |
strip-ansi "^6.0.1" | ||
text-table "^0.2.0" | ||
|
||
react-dom@18.2.0: | ||
version "18.2.0" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" | ||
integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== | ||
react-dom@18.3.1: | ||
version "18.3.1" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" | ||
integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
scheduler "^0.23.0" | ||
scheduler "^0.23.2" | ||
|
||
react-error-overlay@^6.0.11: | ||
version "6.0.11" | ||
|
@@ -7451,10 +7451,10 @@ react-textarea-autosize@^8.3.2: | |
use-composed-ref "^1.0.0" | ||
use-latest "^1.0.0" | ||
|
||
react@18.2.0: | ||
version "18.2.0" | ||
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" | ||
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== | ||
react@18.3.1: | ||
version "18.3.1" | ||
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" | ||
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
|
||
|
@@ -7781,10 +7781,10 @@ sax@^1.2.4: | |
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" | ||
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== | ||
|
||
scheduler@^0.23.0: | ||
version "0.23.0" | ||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" | ||
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== | ||
scheduler@^0.23.2: | ||
version "0.23.2" | ||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" | ||
integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import RemoteImage from './dist/components/remote-image' | ||
export * from './dist/components/remote-image' | ||
export default RemoteImage |
Oops, something went wrong.