0.1.9 • Published 5 years ago

react-booking-timeline v0.1.9

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

react-booking-timeline

React booking timeline generated.

This component has been developed to be able to display room or place reservations. It is therefore not planned to display several events at the same time for the same room/place. It also allows you to select free areas.

Note that react-booking-timeline is based on React 15.

Install

npm install react-booking-timeline

Usage

const BookingTimeline = require("react-booking-timeline");

const groups = [{ id: 1, title: 'group 1' }, { id: 2, title: 'group 2' }]
const items = [
    {
        id: 1,
        group: 1,
        title: 'First item very very very long...',
        start: moment().add(1, 'day').valueOf(),
        end: moment().add(4, 'day').valueOf(),
    },
    {
        id: 2,
        group: 2,
        title: 'item 2',
        start: moment().add(-0.5, 'day').valueOf(),
        end: moment().add(10, 'day').valueOf(),
    },
]

handleSelect = (item) => {
    console.log("item:", item)
}

render () {
    <DateTimeline
      groups={groups}
      items={items}
      onSelect=(this.handleSelect)
    />
}

Props

NameTypeDefault ValueDescription
startdateStringmoment().valueOf()Start date of timeline
enddatestringmoment().add(6,'months').valueOf()End date of timeline
onSelectFunctionFunction called when the user selects an event
contentTooltipRenderFunction(evt) => ({evt.title})Function called to render the content of the tooltip. Tooltip is shown when the user clicks an event.
configObjectsee belowConfig of component

Details of config prop

See below all props for the config prop

NameTypeDefault ValueDescription
localeString"fr"Language
bgColorString"#8dc149"Background color of events
selectedBgColorString"#ffc149"Background color of the selected event
headerBgColorString"#519aba"Background color of the header
headerColorString"white"Text color of the header
freeEventBgColorString"#d2cdcd"Background color of free events
freeEventSelectedBgColorString"#d2cdcd"Background color of the selected free event
groupLabelString""Label of the first column
showGroupsbooltrueShow the group's column
canSelectedFreeEventbooltrueShow free events. User can select free events
showTooltipbooltrueShow tooltip of events
tooltipClassNameStringClassname of tooltip

Example of class for tooltip:

.customeTheme {
  color: black !important;
  background-color: burlywood !important;
  &.place-top {
    &:after {
    border-top-color: burlywood !important;
    border-top-style: solid !important;
    border-top-width: 6px !important;
    }
  }
 }

Limitations

  • Test and design for React 15
  • Show only on event by group. If you have 2 events at the same time in the same group, events will be displayed on top of each other

License

MIT

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago