1.2.1 • Published 2 years ago

react-view-photo-gallery v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

What is this?

📸 A react library helpful render photos in awesome gallery.

Preview

Demo React-View-Photo-Gallery

Installation

Using yarn:

$ yarn add react-view-photo-gallery

Using npm:

$ npm install --save react-view-photo-gallery

Demo

https://tronghieu60s.github.io/react-view-photo-gallery/

Usage

import React, { useState } from 'react';
import PhotoGallery from 'react-view-photo-gallery';

export default function App() {
  const [show, setShow] = useState(false);

  const images = [
    { src: 'https://place.dog/300/200' },
    { src: 'https://place.dog/400/200', name: 'Dog Image 400x200' },
    {
      src: 'https://place.dog/400/300',
      name: 'Dog Image 400x300',
      caption: new Date().toLocaleString(),
    },
  ];

  return (
    <>
      <button onClick={() => setShow(true)}>Show</button>
      <PhotoGallery show={show} onClose={() => setShow(false)} images={images} />
    </>
  );
}

Methods

PropsTypeDescription
show(required) stringAttribute show/hide <PhotoGallery />
onClose(required) FunctionThis function will make hide <PhotoGallery />
images(required) ImageType[]Array for images
currentIndex(optional) numberIndex of current image
openLink(optional) stringPath open link in new tab
showName(optional) booleanShow name of image
showCaption(optional) booleanShow caption of image
showOpenLink(optional) booleanShow open link button
showFullScreen(optional) booleanShow full screen button
showSlideshow(optional) booleanShow slideshow button
showDownload(optional) booleanShow download button
showThumbnails(optional) booleanShow thumbnails button

License

MIT

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.