0.1.14 • Published 2 years ago

react-roulette-board v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-roulette-board

react-roulette-board

Installation

npm

npm install react-roulette-board

Example

import React from "react";
import { RouletteBoard } from "react-roulette-board";

const PinComponent = () => {
  return (
    <div
      style={{
        width: 100,
        height: 100,
        borderRadius: "50%",
        backgroundColor: "red",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        fontWeight: "bold",
        color: "#FFFFFF",
      }}
    >
      START
    </div>
  );
};

const App = () => {
  return (
    <RouletteBoard
      size={8}
      targetIndex={2}
      rotateCount={30}
      onStart={false}
      onEnd={({ index, degree }) => {
        console.log("end", index, degree);
      }}
      width={300}
      height={300}
      backgroundImageSrc="https://example.com/assets/testImage.png"
      pinComponent={<PinComponent />}
    />
  );
};

Props

PropRequiredDefaultTypeDescription
size⭕️2numberThe number of roulette compartment
targetIndex⭕️0numberTarget Index
rotateCount30numberThe number of roulette to rotate
onStart⭕️falsebooleanStart to rotate
onEnd-({ index: number, degree: number}) => voidExecuted when the roulette is finished
width300numberThe width of the roulette board
height300numberThe height of the roulette board
backgroundImageSrc⭕️""stringImage to be put on the roulette board
pinComponent-nodeChildren elements for pin