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

@mycujoo/mcls-components-carousel

v1.0.6

Published

This npm package has been renamed to [`@mycujoo/mcls-components-banner-slider`](https://www.npmjs.com/package/mcls-components-banner-slider). Please use the new package for future updates and installations.

Downloads

12

Readme

Package Renaming Notice

This npm package has been renamed to @mycujoo/mcls-components-banner-slider. Please use the new package for future updates and installations.


MCLS Carousel Component

The carousel is a configurable react component that uses react-slick slider and populates it with data from MCLS.

Please check this CodeSandbox example.

Carousel component

Props:

  • publicKey (required): A string representing your ogranization public key
  • bannerSetId (required): A string representing the unique identifier for the banner set that contains the items to be displayed in the slider.
  • className (optional): A string representing additional CSS classes to be applied to the main slider container, allowing for custom styling.
  • config (optional): An object that holds configuration settings for the carousel slider. This includes properties like slide text formatting, autoplay, autoplaySpeed, infiniteLoop, etc., to control the slider behavior.
  • onData (optional): A function with one parameters data that is the list of banners
  • onSlideClick (optional): A callback function that will be triggered when a slide is clicked. It receives two parameters: slideIndex (number) - the index of the clicked slide, and slide (SliderBanner) - the data object representing the clicked slide.
  • onSlideButtonClick (optional): A callback function that will be triggered when a slide's button is clicked. It receives two parameters: slideIndex (number) - the index of the slide containing the clicked button, and slide (SliderBanner) - the data object representing the slide.
  • onSlideChange (optional): A callback function that will be triggered when the active slide changes. It receives two parameters: slideIndex (number) - the index of the newly active slide, and slide (SliderBanner) - the data object representing the newly active slide.
  • slide (optional): A functional component (FC) representing the custom JSX element that will be rendered for each slide. The component should accept the SlideProps prop type, which allows passing data to the slide component.

Carousel configuration

The configuration object consists of 4 properties:

  • mobileBreakpoint - max number of screen width (in pixels) for displaying the mobile background
  • slide - for slide configuration that allows customisation for the default slider like:
    • primaryText: object of css properties for styling the banner's primary text
    • secondaryText: object of css properties for styling the banner's secondary text
    • button: object of css properties for styling the banner's button text
    • height: css property for setting the banner height
    • contentAlign: one of top, center and bottom for specifing where to align the banner content
    • padding: Css padding value or a pair of padding values (first for mobile slides, and second for others devices)
  • navigation - for slider navigation configuration of the arrows and the dots:
    • arrows and dots: object with:
      • align property of the following shape:
        • horizontal: left, right and center
        • vertical: top, bottom and center
      • size: css value for width and height
      • color: css value for color
  • slickSettings: react-slick configuration

Example of usage:

import Carousel from '@mycujoo/mcls-components-carousel'
import YourSlide from '../slide'
...

  <Carousel
    publicKey="YOUR_ORG_TOKEN" // mandatory
    bannerSetId="BANNER_SET_ID" // mandatory
    slider={YourSlide}
    config={{
      mobileBreakpoint: '320px'
      slide: {
        height: '70vh',
        primaryText: {
          color: '#E55',
        },
        secondaryText: {
          color: '#EF5',
        },
        contentAlign: 'bottom',
      },
      navigation: {
        arrows: {
          color: '#FFF'
          align: {
            vertical: 'bottom',
            horizontal: 'right',
          },
          size: '2.5rem'
        },
        dots: {
          color: '#FFF'
          align: {
            vertical: 'bottom',
            horizontal: 'right',
          },
          size: '4px'
        }
      },
      slickSettings: {
        autoplay: true,
        autoplaySpeed: 10000,
        lazyLoad: 'ondemand',
        dots: true,
        infinite: true,
        arrows: true,
        touchMove: true,
        fade: true,
        accessibility: true,
        draggable: true,
        slidesToShow: 1,
        cssEase: 'cubic-bezier(.04,.98,.61,1)',
        speed: 500,
        prevArrow: <YourCustomArrow direction="prev" />,
        nextArrow: <YourCustomArrow direction="next" />,
      }
    }} 
    />