Simple Media Gallery is an open-source React.js component. It is a ready to use click-through media gallery.
npm install simple-media-gallery
import MediaGallery from "simple-media-gallery";
<MediaGallery
media={media}
title={title}
/>;
title
is a string and the name of the pagemedia
is an array with objects where the parametername
is a string, the parameterimageUrl
is a string, and the parameteralt
is a string
import Lusia from "./Lusia.jpg";
...
render() {
const title = "Cats";
const media = [
{
name: "Lusia",
imageUrl: Lusia,
alt: "Lusia"
},
{
name: "Sleepy",
imageUrl: Sleepy,
alt: "Sleepy"
},
{
name: "Best Friends",
imageUrl: BestFriends,
alt: "BestFriends"
},
{
name: "Fiona",
imageUrl: Fiona,
alt: "Fiona"
},
{
name: "Give Me Food",
imageUrl: GiveMeFood,
alt: "GiveMeFood"
}
];
return (
<MediaGallery
media={media}
title={title}
/>;
)
}
Prop | Type | Description |
---|---|---|
title |
String |
Optional. The title of the page. |
media |
Array |
Required. Include objects in the array to create the media gallery. |
media.name |
String |
Required. Parameter for a media piece. This is the name of the image. |
media.imageUrl |
String |
Required. Parameter for a media piece. This is the path to the image. |
media.alt |
String |
Required. Parameter for a media piece. This is the alt of the image. |