Skip to content

Commit

Permalink
Merge pull request jossmac#79 from jossmac/pr/78
Browse files Browse the repository at this point in the history
Pr/78
  • Loading branch information
jossmac authored Aug 20, 2016
2 parents f9ee95e + 14540bf commit c10cb6b
Show file tree
Hide file tree
Showing 126 changed files with 4,927 additions and 623 deletions.
206 changes: 193 additions & 13 deletions examples/dist/app.js

Large diffs are not rendered by default.

2,645 changes: 2,347 additions & 298 deletions examples/dist/bundle.js

Large diffs are not rendered by default.

Binary file removed examples/dist/images/1024-cat.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-cats.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-chameleon.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-dog.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-ducks.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-goat.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-ostrich.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-pigeon.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-pigs.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-seagulls.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-wasp.jpg
Binary file not shown.
Binary file removed examples/dist/images/1024-yawn.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-cat.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-cats.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-chameleon.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-dog.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-ducks.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-goat.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-ostrich.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-pigeon.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-pigs.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-seagulls.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-wasp.jpg
Binary file not shown.
Binary file removed examples/dist/images/320-yawn.jpg
Binary file not shown.
Binary file removed examples/dist/images/500-cat.jpg
Binary file not shown.
Binary file removed examples/dist/images/500-cats.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-chameleon.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-dog.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-ducks.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-goat.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-ostrich.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-pigeon.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-pigs.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-seagulls.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-wasp.jpg
Diff not rendered.
Binary file removed examples/dist/images/500-yawn.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-cat.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-cats.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-chameleon.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-dog.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-ducks.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-goat.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-ostrich.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-pigeon.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-pigs.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-seagulls.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-wasp.jpg
Diff not rendered.
Binary file removed examples/dist/images/800-yawn.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-cat.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-cats.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-chameleon.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-dog.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-ducks.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-goat.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-ostrich.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-pigeon.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-pigs.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-seagulls.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-wasp.jpg
Diff not rendered.
Binary file removed examples/dist/images/thumbnail-yawn.jpg
Diff not rendered.
2,653 changes: 2,355 additions & 298 deletions examples/dist/standalone.js

Large diffs are not rendered by default.

42 changes: 30 additions & 12 deletions examples/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,47 @@ import { render } from 'react-dom';
import Gallery from './components/Gallery';
import Lightbox from 'react-images';

function capitalizeFirstLetter (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
function makeUnsplashSrc (id) {
return `https://images.unsplash.com/photo-${id}?dpr=2&auto=format&w=1600&h=1600`;
}
function makeUnsplashSrcSet (id, size) {
return `https://images.unsplash.com/photo-${id}?dpr=2&auto=format&w=${size} ${size}w`;
}
function makeUnsplashThumbnail (id) {
return `https://images.unsplash.com/photo-${id}?dpr=2&auto=format&crop=entropy&fit=crop&w=100&h=100`;
}

const IMAGE_NAMES = ['cat', 'cats', 'chameleon', 'dog', 'ducks', 'goat', 'ostrich', 'pigeon', 'pigs', 'seagulls', 'wasp', 'yawn'];
const IMAGE_MAP = IMAGE_NAMES.map(img => ({
src: `./images/800-${img}.jpg`,
thumbnail: `./images/thumbnail-${img}.jpg`,
const IMAGE_NAMES = [
{ id: '1471079502516-250c19af6928', caption: <span><a href="https://unsplash.com/photos/GIpGxe2_cT4" target="_blank">Turtle</a>, by Jeremy Bishop</span> },
{ id: '1455970022149-a8f26b6902dd', caption: <span><a href="https://unsplash.com/photos/a7bdqjeG6M4" target="_blank">Cat</a>, by Mona Magnussen</span> },
{ id: '1470317596697-cbdeda56f999', caption: <span><a href="https://unsplash.com/photos/XgF9e93Tkt0" target="_blank">Ladybug</a>, by Michel Bosma</span> },
{ id: '1454023492550-5696f8ff10e1', caption: <span><a href="https://unsplash.com/photos/LmVSKeDy6EA" target="_blank">Tiger</a>, by Jessica Weiller</span> },
{ id: '1470619549108-b85c56fe5be8', caption: <span><a href="https://unsplash.com/photos/SYzUF6XcWBY" target="_blank">Flamingo</a>, by Alan Emery</span> },
{ id: '1458167072153-a2eb76d67c1c', caption: <span><a href="https://unsplash.com/photos/I4AEXHh00uo" target="_blank">Chimpanzee</a>, by Liz Bridges</span> },
{ id: '1471101173712-b9884175254e', caption: <span><a href="https://unsplash.com/photos/5oRzZU5uwSM" target="_blank">Dragonfly</a>, by Pedro Lastra</span> },
{ id: '1471127432458-65206be149c9', caption: <span><a href="https://unsplash.com/photos/Kpgt4pl03O0" target="_blank">Deer</a>, by Ernesto Velázquez</span> },
{ id: '1470854989922-5be2f7456d78', caption: <span><a href="https://unsplash.com/photos/GXMr7BadXQo" target="_blank">Hedgehog</a>, by Piotr Łaskawski</span> },
{ id: '1470777639313-60af88918203', caption: <span><a href="https://unsplash.com/photos/GNUcUx-iObg" target="_blank">Koala</a>, by Cris Saur</span> },
{ id: '1453550486481-aa4175b013ea', caption: <span><a href="https://unsplash.com/photos/WiSeaZ4E6ZI" target="_blank">Elephant</a>, by Benjamin Pley</span> },
];
const IMAGE_MAP = IMAGE_NAMES.map(({ caption, id }) => ({
src: makeUnsplashSrc(id),
thumbnail: makeUnsplashThumbnail(id),
srcset: [
`./images/1024-${img}.jpg 1024w`,
`./images/800-${img}.jpg 800w`,
`./images/500-${img}.jpg 500w`,
`./images/320-${img}.jpg 320w`,
makeUnsplashSrcSet(id, 1024),
makeUnsplashSrcSet(id, 800),
makeUnsplashSrcSet(id, 500),
makeUnsplashSrcSet(id, 320),
],
caption: capitalizeFirstLetter(img),
caption,
}));

render(
<div>
<h3>Default options</h3>
<p style={{ marginBottom: 40 }}>Use your keyboard to navigate <kbd>left</kbd> <kbd>right</kbd> <kbd>esc</kbd> &mdash; Also, try resizing your browser window.</p>
<Gallery images={IMAGE_MAP} />
<p>Images courtesy of <a href="http://gratisography.com/" target="_blank">Gratisography</a></p>
<p>Images courtesy of <a href="https://unsplash.com/" target="_blank">Unsplash</a></p>

<h3>Without thumbnails</h3>
<p style={{ marginBottom: 40 }}>Set <code>{"thumbnails={false}"}</code> to remove thumbnails</p>
Expand Down
Binary file removed examples/src/images/1024-cat.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-cats.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-chameleon.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-dog.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-ducks.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-goat.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-ostrich.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-pigeon.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-pigs.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-seagulls.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-wasp.jpg
Diff not rendered.
Binary file removed examples/src/images/1024-yawn.jpg
Diff not rendered.
Binary file removed examples/src/images/320-cat.jpg
Diff not rendered.
Binary file removed examples/src/images/320-cats.jpg
Diff not rendered.
Binary file removed examples/src/images/320-chameleon.jpg
Diff not rendered.
Binary file removed examples/src/images/320-dog.jpg
Diff not rendered.
Binary file removed examples/src/images/320-ducks.jpg
Diff not rendered.
Binary file removed examples/src/images/320-goat.jpg
Diff not rendered.
Binary file removed examples/src/images/320-ostrich.jpg
Diff not rendered.
Binary file removed examples/src/images/320-pigeon.jpg
Diff not rendered.
Binary file removed examples/src/images/320-pigs.jpg
Diff not rendered.
Binary file removed examples/src/images/320-seagulls.jpg
Diff not rendered.
Binary file removed examples/src/images/320-wasp.jpg
Diff not rendered.
Binary file removed examples/src/images/320-yawn.jpg
Diff not rendered.
Binary file removed examples/src/images/500-cat.jpg
Diff not rendered.
Binary file removed examples/src/images/500-cats.jpg
Diff not rendered.
Binary file removed examples/src/images/500-chameleon.jpg
Diff not rendered.
Binary file removed examples/src/images/500-dog.jpg
Diff not rendered.
Binary file removed examples/src/images/500-ducks.jpg
Diff not rendered.
Binary file removed examples/src/images/500-goat.jpg
Diff not rendered.
Binary file removed examples/src/images/500-ostrich.jpg
Diff not rendered.
Binary file removed examples/src/images/500-pigeon.jpg
Diff not rendered.
Binary file removed examples/src/images/500-pigs.jpg
Diff not rendered.
Binary file removed examples/src/images/500-seagulls.jpg
Diff not rendered.
Binary file removed examples/src/images/500-wasp.jpg
Diff not rendered.
Binary file removed examples/src/images/500-yawn.jpg
Diff not rendered.
Binary file removed examples/src/images/800-cat.jpg
Diff not rendered.
Binary file removed examples/src/images/800-cats.jpg
Diff not rendered.
Binary file removed examples/src/images/800-chameleon.jpg
Diff not rendered.
Binary file removed examples/src/images/800-dog.jpg
Diff not rendered.
Binary file removed examples/src/images/800-ducks.jpg
Diff not rendered.
Binary file removed examples/src/images/800-goat.jpg
Diff not rendered.
Binary file removed examples/src/images/800-ostrich.jpg
Diff not rendered.
Binary file removed examples/src/images/800-pigeon.jpg
Diff not rendered.
Binary file removed examples/src/images/800-pigs.jpg
Diff not rendered.
Binary file removed examples/src/images/800-seagulls.jpg
Diff not rendered.
Binary file removed examples/src/images/800-wasp.jpg
Diff not rendered.
Binary file removed examples/src/images/800-yawn.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-cat.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-cats.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-chameleon.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-dog.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-ducks.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-goat.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-ostrich.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-pigeon.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-pigs.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-seagulls.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-wasp.jpg
Diff not rendered.
Binary file removed examples/src/images/thumbnail-yawn.jpg
Diff not rendered.
2 changes: 1 addition & 1 deletion src/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Footer ({
};

Footer.propTypes = {
caption: PropTypes.string,
caption: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
countCurrent: PropTypes.number,
countSeparator: PropTypes.string,
countTotal: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion src/Lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Lightbox.propTypes = {
PropTypes.shape({
src: PropTypes.string.isRequired,
srcset: PropTypes.array,
caption: PropTypes.string,
caption: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
})
).isRequired,
isOpen: PropTypes.bool,
Expand Down

0 comments on commit c10cb6b

Please sign in to comment.