1.1.2 โ€ข Published 3 years ago

@jjunyjjuny/react-carousel v1.1.2

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

Notice!

  • I am practicing npm publish right now. There may be an error, so be careful when using it....

  • I plan to add function loop or not, autoplay, dot or number counter ...

  • Thank you for your attention!!

๐ŸŽ  react-carousel

this library make list into carousel in React

๐Ÿ”ฒSample

carousel2

carousel3

๐Ÿš€ Installation

Using npm :

$ npm i @jjunyjjuny/react-carousel

Usage with styled-components

default

import styled from "styled-components";
import Carousel from "@jjunyjjuny/react-carousel";

const Container = styled.div`
  margin: 0 auto;
  margin-top: 100px;
  width: 480px;
`;
const Item = styled.div`
  background: #dbe4ff;
  text-align: center;
  font-size: 2rem;
  line-height: 145px;
  height: 150px;
  border-radius: 10px;
`;

const sampleArray = [1, 2, 3, 4, 6, 7, 8];
const CarouselSample = () => {
  return (
    <Container>
      <h2 style={{ textAlign: "center" }}>Sample Carousel</h2>
      <Carousel itemCountPerPanel={3}>
        {sampleArray.map((el) => (
          <Item>{el}</Item>
        ))}
      </Carousel>
    </Container>
  );
};

export default CarouselSample;

customMode

import styled from "styled-components";
import Carousel, { Controller } from "@jjunyjjuny/react-carousel";

const Container = styled.div`
  margin: 0 auto;
  margin-top: 100px;
  width: 480px;
`;
const Item = styled.div`
  background: #dbe4ff;
  text-align: center;
  font-size: 2rem;
  line-height: 145px;
  height: 150px;
  border-radius: 10px;
`;
const ControllerBox = styled.div`
  display: flex;
  justify-content: center;
  margin-top: 20px;
`;
const sampleArray = [1, 2, 3, 4, 6, 7, 8];
const CarouselSample = () => {
  return (
    <Container>
      <h2 style={{ textAlign: "center" }}>Sample customMode</h2>
      <Carousel itemCountPerPanel={3} customMode carouselId={"jjunyjjuny"}>
        {sampleArray.map((el) => (
          <Item>{el}</Item>
        ))}
      </Carousel>
      <ControllerBox>
        <Controller prev carouselId={"jjunyjjuny"} />
        <Controller next carouselId={"jjunyjjuny"} />
      </ControllerBox>
    </Container>
  );
};

export default CarouselSample;

๐Ÿ“ƒ props

Carousel

NameValueDescription
itemCountPerPanelnumberNumber of items to show at a timer per piece
gapstringGap length between items
customModebooleanCustom mode can be activated with this prop. In custom mode, the carousel and controller can be separated.
carouselIdprimitive typeThe only value that corresponds to the controller in custom mode.

Controller

NameValueDescription
carouselIdprimitive typeThe ID value of the carousel to which the controller will move
prev, nextbooleanDirection in which the controller moves the carousel
childrenComponent, jsxif you want your own button, insert it as children
1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago