@rumess/react-light-gallery

1.0.9 • Public • Published

@rumess/react-light-gallery

NPM JavaScript Style Guide

DEMO

Install

npm install --save @rumess/react-light-gallery

Usage

Basic Usage

import React, { Component } from 'react'

import Gallery from '@rumess/react-light-gallery'

class Example extends Component {
  render () {
    const items = [
      {
        name: 'Name here', // Optional
        image: '/path/to/image',
        thumbnail: '/path/to/image', // Optional
        caption: 'Caption here' // Optional
      },
      {
        name: 'Name here', // Optional
        image: '/path/to/image',
        thumbnail: '/path/to/image', // Optional
        caption: 'Caption here' // Optional
      },
      ...
    ];

    return (
      <Gallery items={ items } overlay={ true } overlayColor="rgba( 255,0,0,.5 )" />
    )
  }
}

With overlay Contents

import React, { Component } from 'react'

import Gallery from '@rumess/react-light-gallery'

class Example extends Component {
  overlayContent = ( item, index ) => {
    return <h1 style={{textAlign: "center"}}>{item.caption}</h1>
  }
  render () {
    const items = [
      {
        name: 'Name here', // Optional
        image: '/path/to/image',
        thumbnail: '/path/to/image', // Optional
        caption: 'Caption here' // Optional
      },
      {
        name: 'Name here', // Optional
        image: '/path/to/image',
        thumbnail: '/path/to/image', // Optional
        caption: 'Caption here' // Optional
      },
      ...
    ];

    return (
      <Gallery items={ items } overlay={ this.overlayContent } overlayColor="rgba( 255,0,0,.5 )" />
    )
  }
}

License

MIT © rumess

Package Sidebar

Install

npm i @rumess/react-light-gallery

Weekly Downloads

1

Version

1.0.9

License

MIT

Unpacked Size

33 kB

Total Files

6

Last publish

Collaborators

  • rumesh38