-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix download links to cross-origin images
Fixes #25. Cross-origin images are downloaded with fetch. Preparing to publish `2.6.0` soon once additional fixes are ready.
- Loading branch information
Showing
7 changed files
with
171 additions
and
94 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 |
---|---|---|
|
@@ -5,4 +5,6 @@ | |
/node_modules | ||
/umd | ||
npm-debug.log* | ||
.vscode | ||
.vscode | ||
cypress/screenshots | ||
cypress/downloads |
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 |
---|---|---|
@@ -1,90 +1,99 @@ | ||
import React, { Component } from "react"; | ||
import { render } from "react-dom"; | ||
import React from "react"; | ||
import { createRoot } from 'react-dom/client'; | ||
|
||
import ModalImage from "../../src"; | ||
|
||
class Demo extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<h1>react-modal-image</h1> | ||
|
||
<h2>#1 with alt, small, medium and large props</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
alt="Here is the caption" | ||
small="example_img_small.jpg" | ||
medium="example_img_medium.jpg" | ||
large="example_img_large.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#2 with small and large props defined only</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#3 with small and medium props defined only</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
medium="example_img_medium.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#4 with download and zoom -buttons hidden</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
hideDownload={true} | ||
hideZoom={true} | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#5 with transparent png shown in hotpink background</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
small="example_transparent_heart.png" | ||
large="example_transparent_heart.png" | ||
hideDownload={true} | ||
hideZoom={true} | ||
imageBackgroundColor="hotpink" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#6 with rotation -button displayed</h2> | ||
|
||
<div style={{ maxWidth: "400px" }}> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
showRotate={true} | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>Further info</h2> | ||
|
||
<p> | ||
<a href="https://github.com/aautio/react-modal-image">Github</a> | ||
</p> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
render(<Demo />, document.querySelector("#demo")); | ||
import pkg from "../../package.json" | ||
|
||
const Demo = () => ( | ||
<div> | ||
<h1>Demo of react-modal-image@{pkg.version}</h1> | ||
|
||
<h2>#1 with alt, small, medium and large props</h2> | ||
|
||
<div> | ||
<ModalImage | ||
alt="Here is the caption" | ||
small="example_img_small.jpg" | ||
medium="example_img_medium.jpg" | ||
large="example_img_large.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#2 with small and large props defined only</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#3 with small and medium props defined only</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
medium="example_img_medium.jpg" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#4 with download and zoom -buttons hidden</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
hideDownload={true} | ||
hideZoom={true} | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#5 with transparent png shown in hotpink background</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="example_transparent_heart.png" | ||
large="example_transparent_heart.png" | ||
hideDownload={true} | ||
hideZoom={true} | ||
imageBackgroundColor="hotpink" | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#6 with rotation -button displayed</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="example_img_small.jpg" | ||
large="example_img_large.jpg" | ||
showRotate={true} | ||
/> | ||
</div> | ||
<p>^ click or inspect the image above</p> | ||
|
||
<h2>#7 with images from external domain</h2> | ||
|
||
<div> | ||
<ModalImage | ||
small="https://dummyimage.com/420x200/000/aaa" | ||
large="https://dummyimage.com/640x360/000/aaa" | ||
/> | ||
</div> | ||
|
||
<h2>Further info</h2> | ||
|
||
<p> | ||
<a href="https://github.com/aautio/react-modal-image">Github</a> | ||
</p> | ||
</div> | ||
); | ||
|
||
// @ts-ignore | ||
const root = createRoot(document.querySelector("#demo")); | ||
root.render(<Demo />); |
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