react-reserver

1.4.0 • Public • Published

react-reserver

The best time blocking solution Find yourself needing to add a way to reserve a conference room in your office? Schedule shifts for your employees? Hotel or restaurant reservations? Project management? All of this but totally customizable???

This is the solution you've been looking for!

react-reserver is a time blocking solution. It creates a grid which allows you block out different time slots.

NPM JavaScript Style GuideBuild Statuscodecov npm version GitHub All Releases npm

Working Example and Docs

Install

npm install --save react-reserver
 
or 
 
yarn add react-reserver

Usage

import React from 'react'
 
import Reserver, { Bar, useReserver, reserverReducer, createBar, getPosition, resizeBars} from 'react-reserver'
 
 
function App(){
 
   const { bars, addBar, setBars } = useReserver(reserverReducer, [])
  
    return <Reserver       
        mouseDownCell={(props) => {
            const newbar = createBar(props.dimension, props.cell);
            addBar(newbar)
        }}
 
        mouseEnterCell={(props) => {
            const nBars = resizeBar(bars, props)
            setBars(nBars)
        }}
 
        mouseUpCell={() => {  
            const dBars = bars.map((bar) => {
                if (bar.editing) {
                    return { ...bar, editing: false }
                }
                return bar;
            })
            setBars(dBars)
        }}
 
    >
        {
 
            bars.map((bar) => { return <Bar key={bar.id} {...bar} style={{ ...getPosition(bar.row, bar.column, bar.dimension) }} /> })
        }
    </Reserver>
}

basic

HotelReservation projectTimeline

License

MIT © shmuelpro

Readme

Keywords

none

Package Sidebar

Install

npm i react-reserver

Weekly Downloads

3

Version

1.4.0

License

MIT

Unpacked Size

106 kB

Total Files

6

Last publish

Collaborators

  • shmuelpro