2.37.0-0 • Published 1 year ago
schedule-react-component v2.37.0-0
Schedule-react-compoent
<Schedule onAdd={onAdd} onCancel={onCancel} />
Installing
$ npm i schedule-react-component
Exports
import { Schedule, Ireservation } from 'schedule-react-component';
Props
Common props you may want to specify include:
workingHours
- the working hours example : { hour: '9-10', isReserved: false, val: 9 }, { hour: '10-11', isReserved: false, val: 10 }, { hour: '11-12', isReserved: false, val: 11 }, { hour: '13-14', isReserved: false, val: 13 }, { hour: '14-15', isReserved: false, val: 14 }, { hour: '15-16', isReserved: false, val: 15 }, { hour: '16-17', isReserved: false, val: 16 }daysOff
- the days you don't want to reserve example : 'Sun','Sat'reservations
- reservations dataOnAdd
- on add reservationcalendarClass
- calendar css classdayClass
- day css classhourClass
- hour css classdialogClass
- dialog css classdialogTitle
- dialog titleinput
- choose the dialog input , select or other component ...cancelDialogTitle
- cancel dialog titleonCancel
- on cancecl reservation functioncancelDialogClass
- cancel dialog css class
Schedule Usage
import { Ireservation, Schedule } from 'schedule-react-component'
//your data
const reservs: Array<Ireservation> = [
{ date: "2023-01-06T00:00:00.000Z", day: 6, hour: 14, id: 1, month: 1, year: 2023 },
{ date: "2023-01-06T00:00:00.000Z", day: 6, hour: 15, id: 1, month: 1, year: 2023 },
{ date: "2023-01-07T00:00:00.000Z", day: 7, hour: 16, id: 1, month: 1, year: 2023 },
{ date: "2023-02-06T00:00:00.000Z", day: 6, hour: 15, id: 1, month: 2, year: 2023 },
{ date: "2023-03-06T00:00:00.000Z", day: 6, hour: 15, id: 1, month: 3, year: 2023 },
{ date: "2023-04-06T00:00:00.000Z", day: 6, hour: 15, id: 1, month: 4, year: 2023 },
{ date: "2023-05-06T00:00:00.000Z", day: 31, hour: 15, id: 1, month: 1, year: 2023 },
]
const Component = () => {
const onAdd = (hour: number, day: number, month: number, year: number) => {
Post('api/addReservation',{hour,day,month,year})
}
const onCancel = (hour: number, day: number, month: number, year: number) => {
Delete('api/deleteReservation',{hour,day,month,year})
}
return (
<div>
<Schedule OnAdd={onAdd} onCancel={onCancel} reservations={reservs} />
</div>
)
}
export default Component
License
MIT
2.37.0-0
1 year ago
2.36.0
1 year ago
2.35.0
1 year ago
2.34.0
1 year ago
2.33.0
1 year ago
2.32.0
1 year ago
2.31.0
1 year ago
2.30.0
1 year ago
2.29.0
1 year ago
2.28.0
1 year ago
2.27.0
1 year ago
2.26.0
1 year ago
2.25.0
1 year ago
2.24.0
1 year ago
2.22.0
1 year ago
2.21.0
1 year ago
2.20.0
1 year ago
2.18.0
1 year ago
2.17.0
1 year ago
2.16.0
1 year ago
2.15.0
1 year ago
2.14.0
1 year ago
2.13.0
1 year ago
2.12.0
1 year ago
2.11.0
1 year ago
2.10.0
1 year ago
2.8.0
1 year ago
2.7.0
1 year ago
2.6.0
1 year ago
2.5.0
1 year ago