1.1.8 • Published 2 years ago

@herii/react-gallery v1.1.8

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

@herii/react-gallery

preview

A Component to add a Gallery to your React Projet

This is a very simple but powerful react component that allows you to add a gallery with different cool features.

💫 DEMO 🚀 💫

You can see a demo here on codesandbox.io

🚀 Features

  • Add blur to a specific image of the gallery
  • Add a parallax effect
  • Add Content to the gallery (On top of an image of your gallery)
  • You get two arrows to control the selected image.
  • The images are preloaded for a fast and smooth transition between each image in the gallery

💽 Installation

You can use npm or yarn to add our package to your project.

yarn add @herii/react-gallery

npm install @herii/react-gallery

And of course Dillinger itself is open source with a public repository on GitHub.

💻 How to use

Import Gallery from our

import {Gallery} from '@herii/react-gallery'

Now you are ready to use our component inside your app:

<Gallery items={[{
                img: "https://cdn.pixabay.com/photo/2022/05/31/17/14/bird-7233900_1280.jpg",
                blur: true,
                children: <div className='flex-center'>
                    <div>
                    <h1>Birds are cool</h1>
                    <p style={{color: 'white'}}>So as this gallery component is</p>
                    </div>
                </div>
            }, 
            {
                img: "https://cdn.pixabay.com/photo/2016/11/23/18/27/hummingbird-1854225_1280.jpg",
                parallax: true,
            }]
        } type="default" />

Properties

The Component's properties are listed below.

type (string)

The type of transition effect that the gallery will run when moving from an image to another.

valuedescription
defaultThe default transition moves the gallery from left to right /right to left
fade-blurfade in / fade out with a blurry effect

width

The width of the container of the images (The images use 100% of the width of the container)

typedefault
string'100vw'

height

The height of the container of the images (The images use 100% of the height of the container)

typedefault
string'100vh'

disableControls

Don't like the arrows? You can hide them by setting this option to true.

typedefault
booleanfalse

loop

If you set this option to true then the gallery will move its items automatically.

typedefault
booleanfalse

interval

The interval at which the gallery will move its items (In milliseconds)

typedefault
int5000

Items

The only parameter you can pass right now is the items which is an array of objects

[
    {
        // Object #1
    },
    {
        // Object #2...
    }
]

Each Object can have the following properties:

PropertyType(s)ExampleDefaultDescription
imgstringhttps://cdn.pixabay.com/photo/2022/05/31/17/14/bird-7233900_1280.jpgnullThe IMG URL or any object that can be passed to URL() in a background image: background-image: url(img)
blurbooleantruefalseAdd a blur on top of the image
parallaxbooleantruefalseAdd a parallax effect to the image when scrolling the container
childrenJSX<>This is a React Fragment</>nullJSX that will be added on top of the image, by default you don't have styles here but you can add your own styles to the JSX elements to center the elements

Example of an object with all properties

{
    img: "https://cdn.pixabay.com/photo/2022/05/31/17/14/bird-7233900_1280.jpg",
    blur: true,
    parallax: true,
    children: <>Hello</>
}

Support

I created this project it to use it in my own projects as a reusable component and I support it and update it as much as I require to.

If you find any issue/glitch/bug you can create an issue by clicking here and I'll review it and fix it as soon as possible.

If you want to support further development of this package / new features / etc, You can do it by donating me whathever amount you desire.

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago