1.0.3 • Published 3 years ago

@sabbir1055/drag-drop-puzzle v1.0.3

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

Description

This a funny puzzle game. Only adding one image your can slice it into what ever pieces you want to make it more complex.

Installation

npm i @sabbir1055/drag-drop-puzzle --save

Uses

import React from 'react'
import Puzzle from '@sabbir1055/drag-drop-puzzle'
function App() {

  const finalResult = (data) => {
    console.log(data)
  }

  return (
      <>
        <Puzzle imgUrl = 'https://cdn.jpegmini.com/user/images/slider_puffin_before_mobile.jpg' getResult = {finalResult}/>
      </>
  )
}

export default App;

Options

drag-drop-puzzle support many options. These are :

Option nameDescriptionData TypeDefault
widthyour full canvas widthnumeric600
heightyour full canvas heightnumeric600
XLengthHow many pieces do yout need for X axisnumeric4
YLengthHow many pieces do yout need for Y axisnumeric4
imgUrlImage url that will be splices into XLength * YLength piecesstringalt text
parentClassStyle your outer canvasstringnull
childClassStyle your inner elements of canvasstringnull
getResultcallback function that return the resultstringreturn success or keep trying

Git repository

If you want to contribute click here