1.5.16 • Published 2 years ago

react-pic-gallery v1.5.16

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

react-pic-gallery

NPM

React library for a simple image gallery with lightbox implemented.

Features

  • 📱 Responsive
  • 🚵 Lazy load on pictures
  • ✏ Buttons and CSS customization classes are accessible
  • 💡 Lightbox implemented with pinch zoom by react-zoom-pan-pinch

Demo

https://marcelrsoub.github.io/react-pic-gallery/

demo gif

Install

npm install --save react-pic-gallery

or with yarn:

yarn add react-pic-gallery

Usage

A list of objects containing a thumbnail source and the full source is the only needed parameter.

import React from 'react'
import PicGallery from 'react-pic-gallery'

const listOfImages = [
  {
    thumbnailSrc: 'https://picsum.photos/id/237/200/300',
    fullSrc: 'https://picsum.photos/id/237/800/600'
  },
  {
    thumbnailSrc: 'https://picsum.photos/id/154/200/150',
    fullSrc: 'https://picsum.photos/id/154/200/150'
  }
]

const App = () => {
  return (
    <div>
      <PicGallery imgList={listOfImages} />
    </div>
  )
}

export default App

Options

The options interface can be imported from the library and the object can be passed in the main component:

import React from 'react'
import PicGallery from 'react-pic-gallery'

const listOfImages = [
  {
    thumbnailSrc: 'https://picsum.photos/id/237/200/300',
    fullSrc: 'https://picsum.photos/id/237/800/600',
    description: 'A Dog standing on a wooden floor'
  },
  {
    thumbnailSrc: 'https://picsum.photos/id/154/200/150',
    fullSrc: 'https://picsum.photos/id/154/200/150'
  }
]

const options = {
  // customLoadComponent: () => <h3>Loading</h3>,
  // hidePagination: false,
  // externalLightbox: true,
  // rowHeight: '100px',
  // picsPerRow:3
}

const App = () => {
  return (
    <div>
      <PicGallery imgList={listOfImages} options={options} />
    </div>
  )
}

export default App

License

MIT © marcelrsoub

1.5.16

2 years ago

1.5.14

2 years ago

1.5.13

2 years ago

1.5.15

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.5.10

2 years ago

1.5.9

2 years ago

1.5.8

2 years ago

1.5.7

2 years ago

1.5.6

2 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.2.8

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.9

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago