react-kinda-slider

0.0.5 • Public • Published

Kinda React slider

Draft, not optimized yet

Usage

import React from 'react';
import Carousel from 'react-kinda-slider';
 
const Cards = ({ items = [] }) => {
  return (
    <Carousel
      infinite
      draggable
      withControls
      items={items}
      renderItem={(item, index, realIndex) => (
        <div className='card' key={realIndex}>
          <h3>{item.title}</h3>
          <p>{item.text}</p>
        </div>
      )}
      renderControl={({ canUse, onUse, type }) => (
        <button onClick={onUse} disabled={canUse}>
          {type === 'forward' ? '>' : '<'}
        </button>
      )}
    />
  );
};

Goals

  • infinite mode for "targetIndex" prop update
  • optimization (memoize calculations)
  • refactoring
  • unit-tests

Readme

Keywords

none

Package Sidebar

Install

npm i react-kinda-slider

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

34.7 kB

Total Files

28

Last publish

Collaborators

  • krutoo