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-adaptable-carousel

v0.8.0

Published

This is a react.js based TypeScript module, offers two types of carousel, normal and queue. Features includes auto-scroll, hover pause, drag/swipe.

Downloads

43

Readme

React Adaptable Carousel

A simple and easy to use carousel.

[![NPM Version][npm-image]][https://www.npmjs.com/package/react-adaptable-carousel] [![Build Status][travis-image]][travis-url] [![Downloads Stats][npm-downloads]][https://www.npmjs.com/package/react-adaptable-carousel]

React Adaptable Carousel(RAC) is a react.js based TypeScript module, offers two types of carousel, normal and queue. Features includes auto-scroll, hover pause, drag/swipe, video slide.

Installation

npm i react-adaptable-carousel
yarn add react-adaptable-carousel

Usage example

RAC has two modules, CarouselFullWidth & CarouselQueue

'CarouselFullWidth'

This module will have each slide take full with of the container, in other word, one slide per time.

Live Example

import { CarouselFullWidth } from 'react-adaptable-carousel';
/**
  * @param { object } themeColor - Carousel Theme color, including prev/next buttons and scroll bar
  *  @param { string } themeColor.button - button color, hex color code
  *  @param { string } themeColor.buttonText - button Text Color, hex color code
  *  @param { string } themeColor.scrollBar - scrollbar color, hex color code
  * @param { object } [buttonText] - buttons text
  *  @param { boolean } [buttonText.isImageBg = false] - if take image as background, image size should be 40 x 100
  *  @param { string } [buttonText.prev = '<'] - prev button text / img src
  *  @param { string } [buttonText.next = '>'] - next button text / img src
  * @param { number } [componentHeight = 'auto'] - height of the Carousel,
  * @param { boolean } isDivElement - if the children are div element
  * @param { array } [urlArray] - if not div elements, urlArray has to be set
  * @param { number } [interval] - interval between slides
  * @param { number } [pauseCarousel] - leave it undefined if you want auto move, set to a number to pause on certain index
*/
const App = () => {
  const args = {
    urlArray: [
    {
      url: 'https://via.placeholder.com/200x300.png?text=0',
      link: 'https://placeholder.com',
    },
    {
      url: 'https://youtu.be/kjZ2ZbPNtA4',
      link: '',
      isVideo: true,
    },
  ],
  componentHeight: 400,
  buttonText: {
    isImageBg: false,
    prev: 'https://via.placeholder.com/40x100.png?text=<',
    next: 'https://via.placeholder.com/40x100.png?text=>',
  },
  themeColor: {
    button: '#961c1c',
    buttonText: '#fff',
    scrollBar: '#961c1c',
  },
  interval: 3000,
  pauseCarousel: 7,
  }
  return (
    <CarouselFullWidth {...args} />
  );
}

'CarouselQueue'

This module will show multiple slides per screen, base on the real size of the slides. This module currently don't take video url.

Live Example

import { CarouselQueue } from 'react-adaptable-carousel';
/**
 * @param { object } themeColor - Carousel Theme color, including prev/next buttons and scroll bar
 *  @param { string } themeColor.reminder - reminder color
 *  @param { string } themeColor.reminderTxt - reminder Text Color
 * @param { object } [reminder] - both ends reminder
 *  @param { boolean } [showReminder = true] - whether to show reminder
 *  @param { string } [reminder.firstTxt = 'First One'] - text on the reminder for first one, default first one
 *  @param { string } [reminder.lastTxt = 'Last One'] - text on the reminder for last one, default last one
 * @param { boolean } [componentHeight = 'auto'] - height of the Carousel,
 * @param { object } [buttonText] - buttons text
 *  @param { boolean } [showButton = true] - whether show buttons
 *  @param { number } [buttonWidth = 20] - button width
 *  @param { number } [buttonHeight = 100] - button height
 *  @param { boolean } [buttonText.isImageBg = false] - whether take image as background, image size should be 40 x 100
 *  @param { string } [buttonText.prev = '<'] - prev button text / img src
 *  @param { string } [buttonText.next = '>'] - next button text / img src
 * @param { number } gap - space between children
 * @param { number } [roundCorner = 0] - round corner of child element
 * @param { boolean } isDivElement - if the children are div element
 * @param { array } [urlArray] - if not div elements, urlArray has to be set
 * @param { number } [divElementMinWidth] - if div element, need to set divElementMinWidth
 */
const App = () => {
  const args = {
    urlArray: [
      { url: 'https://via.placeholder.com/200x300.png?text=0', link: '' },
      { url: 'https://via.placeholder.com/400x300.png?text=1', link: '' },
      { url: 'https://via.placeholder.com/300x300.png?text=2', link: '' },
      { url: 'https://via.placeholder.com/200x300.png?text=3', link: '' },
      { url: 'https://via.placeholder.com/400x300.png?text=4', link: '' },
      { url: 'https://via.placeholder.com/300x300.png?text=5', link: '' },
      { url: 'https://via.placeholder.com/200x300.png?text=6', link: '' },
      { url: 'https://via.placeholder.com/400x300.png?text=7', link: '' },
      { url: 'https://via.placeholder.com/300x300.png?text=8', link: '' },
    ],
    componentHeight: 0, // set 0 means to set image height to auto
    isDivElement: false,
    gap: 12,
    reminder: {
      showReminder: false,
    },
    buttonText: {
      showButton: true,
      buttonWidth: 40,
      buttonHeight: 80,
      isImageBg: true,
      prev: 'https://via.placeholder.com/40x80.png?text=<',
      next: 'https://via.placeholder.com/40x80.png?text=>',
    },
  };
  return (
    <CarouselFullWidth {...args} />
  );
}

Meta