Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunian committed Sep 13, 2017
1 parent c60542f commit 9985366
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To install:
npm install --save react-photo-gallery
```

## Demo
## Examples

[http://neptunian.github.io/react-photo-gallery/](http://neptunian.github.io/react-photo-gallery/)

Expand Down Expand Up @@ -110,7 +110,7 @@ The number of columns to display and when they change is something the user has

### Passing in photos

In the demo I chose to have one object of photos that I pass in to both the Gallery component and the Lightbox component to keep the code cleaner and stateless. Stateless because I can keep the Lightbox outside of the Gallery component and the user can decide whether to use any Lightbox of their choosing or none at all. I added all the properties into this object that either component might need or that I wanted to use for customization.
Pass in an array of objects, each representing a photo, with the necessary properties outlined in the table above. Since the [Lightbox](https://github.com/jossmac/react-images) component being used in one of the demos needs a similar array, the same one is passed into it.

### Passing in a custom image component

Expand Down
20 changes: 10 additions & 10 deletions examples/src/ExampleWithLightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ class ExampleWithLightbox extends React.Component {
<div>
<h2>Using a Lightbox:</h2>
<Gallery photos={this.props.photos} columns={this.props.columns} onClick={this.openLightbox}/>
<Lightbox
theme={{ container: { background: 'rgba(0, 0, 0, 0.85)' } }}
images={this.props.photos.map(x => ({ ...x, srcset: x.srcSet, caption: x.title }))}
backdropClosesModal={true}
onClose={this.closeLightbox}
onClickPrev={this.gotoPrevious}
onClickNext={this.gotoNext}
currentImage={this.state.currentImage}
isOpen={this.state.lightboxIsOpen}
width={1600}
<Lightbox
theme={{ container: { background: 'rgba(0, 0, 0, 0.85)' } }}
images={this.props.photos.map(x => ({ ...x, srcset: x.srcSet, caption: x.title }))}
backdropClosesModal={true}
onClose={this.closeLightbox}
onClickPrev={this.gotoPrevious}
onClickNext={this.gotoNext}
currentImage={this.state.currentImage}
isOpen={this.state.lightboxIsOpen}
width={1600}
/>
</div>
);
Expand Down

0 comments on commit 9985366

Please sign in to comment.