react-puzzle-confirm
Version:
React confirm modal, by fitting puzzle piece
113 lines (70 loc) • 2.4 kB
Markdown
//badge.fury.io/js/react-puzzle-confirm.svg)](https://badge.fury.io/js/react-puzzle-confirm)
```json
"react": "^16.9.0",
"react-dom": "^16.9.0"
```
<img width="500" src="https://github.com/ozluy/react-puzzle-confirm/blob/master/react-puzzle.gif" />
```
<ReactPuzzleConfirm />
```
<a target="_blank" rel="noopener noreferrer" href="http://ozluy.github.io/projects/react-puzzle-confirm"> Demo </a>
<a target="_blank" rel="noopener noreferrer" href="https://codesandbox.io/s/react-puzzle-confirm-fsdcf"> Code Sandbox </a>
Install as a node module
`npm i react-puzzle-confirm -S`
```jsx
import React from 'react'
import ReactPuzzleConfirm from 'react-puzzle-confirm'
import 'react-puzzle-confirm/eact-puzzle-confirm.css'
const Demo = () => (
<ReactPuzzleConfirm
onClose={() => setShowModal(false)}
onSuccess={() => setShowModal(false)}
onFail={() => console.log("failed")}
title="Please fit the puzzle piece carefully"
sliderTitle="Slide to complete the puzzle"
failMessage="Error"
successMessage="Success"
closeButtonLabel="Close"
refrefButtonLabel="Refresh"
disableRefreshIdleState={false}
/>
)
export default Demo
```
default `() => console.log('success')`
function for successful attempt
default `() => console.log('fail')`
function for failed attempt
default `() => console.log('close clicked')`
function for close button click
default `"Please fit the puzzle piece carefully"`
default `"Slide to complete the puzzle"`
default`"Error"`
default`"Success"`
default`"Close"`
default `"Refresh"`
default `true`
important note
===
For older versions of React 15.0.0 and above (^15.0.0) please install following version with tag `react-v15.0.0` or `1.0.16`
`npm install react-puzzle-confirm@react-v15.0.0 -S`
or
`npm install react-puzzle-confirm@1.0.16 -S`
<a href="https://paypal.me/ozluy"> <img src="https://github.com/ozluy/react-stripe-script-loader/blob/master/buy-me-a-coffee-with-paypal.png" /></a>
Thanks
Yusuf Özlü
[![npm version](https: