Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lightbox implementation
import React from 'react';
import Lightbox from 'react-images';
import Button from '../Button';
const MyComponent = ReactCreateClass({
getInitialState() {
return {
lightboxIsOpen: false
};
},
closeLightbox() {
this.setState({
lightboxIsOpen: false
});
},
showLightbox() {
this.setState({
lightboxIsOpen: true
});
return (
<Lightbox
images={[{ src: 'http://static.boredpanda.com/blog/wp-content/uploads/2016/01/bear-dogs-310__605.jpg' }]}
isOpen={this.state.lightboxIsOpen}
onClose={this.closeLightbox} />
);
},
render() {
return (
<div>
<Button
type="primary"
size="md"
onClick={this.showLightbox}
label="Hi" />
</div>
);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.