npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-media-carousel

v1.0.39

Published

A react material ui media carousel.

Downloads

119

Readme

React Media Carousel

A media carousel that supports video, photo & audio combination, a title, and story. Keyboard left, right, arrows and spacebar for pause/playback. Auto slide show when video and audio playback completes. CSS animation for transitions.

Currently this depends on React 18 and up and Material UI 5.15.

Preview:

preview GIF

Installation:

npm install react-media-carousel

or

yarn add react-media-carousel

Usage Example:

import useMediaCarousel from "react-media-carousel";

const data = [
  {
    story: "My Story",
    title: "Today I went swimming",
    src: "https://images.unsplash.com/photo-1438029071396-1e831a7fa6d8?q=80&w=3500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
    mediaType: "photo",
    audioSrc:"https://d9olupt5igjta.cloudfront.net/samples/sample_files/171110/2fae439df204976114e6126cca1b7545dbfa9467/mp3/_impact_water.mp3?1670416639",
  }
];

const [mediaCarousel, openMediaCarousel] = useMediaCarousel({slides: data});

return (
    <div>
    <div onClick={() => {
        openMediaCarousel();
    }}>Click Here</div>
    {mediaCarousel}
    </div>
)

Props

slides: array of objects (each object is a Slide defined below)
theme: string ("dark" or "light")
slideShow: boolean (true will automatically move to next slide in 5000 ms.)
slideDuration: number (override the default 5000 ms with your own slide duration.)
showNextButton: boolean (true will show a Next Button below the story.)
nextButton: object (This is a way to override the next button.  Create a div of 45px to your own style.  No need to implement on click for next slide.  Just style the button.)
nextButtonText: string (This is a way to override the text of the Next button.  Maybe for a translation.)
swipeThreshold: number (override the default 50 px threshold for sliding to the next or previous slide.)
fontSize: number (override the story font size of 16.)
fontWeight: string (override the css font weight of the story.)
fontFamily: string (override the css font family of the story.)
opacity: number (override the default css opacity for the Backdrop. Range [0 to 1])
desktopSlideWidth: number (override the default width of a desktop slide.)
desktopSlideHeight: number (override the default height of a desktop slide.)
title: object (React object to add a title to the carousel just above the main slide.)
showClose: boolean: (Set to false to hide the close X in the upper right hand corner.  True by default.)
customAudioPlayer: boolean: (Set to true to display a customized audio player rather than the default browser audio player.)
disableSwipe: boolean (Set to true to disable swipe events.)
enableMarkdown: bool (markdown supported)

Slide fields

story: string,
title: string,
src: string (url of the photo or video),
mediaType: string ("photo" or "video"),
audioSrc: string (url of the audio for the slide.  Optional),

Supported story special characters

\n : Will generate a new line with <br/>,
&bull; : Will generate a bullet point with &bull; injected into the DOM.