Created
January 10, 2018 20:17
-
-
Save ehahn9/5d2b1980c029c7510a04def8c6c83476 to your computer and use it in GitHub Desktop.
react-big-calendar timeslots test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import BigCalendar from 'react-big-calendar'; | |
class BigCalendarTimeslotsTest extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { timeslots: 2 }; | |
} | |
render() { | |
const { timeslots } = this.state; | |
const step = 60 / timeslots; | |
return ( | |
<div> | |
<div> | |
<p style={{ fontSize: '24pt' }}> | |
<input | |
style={{ width: '3em', textAlign: 'center' }} | |
type="number" | |
value={timeslots} | |
min={1} max={20} | |
onChange={e => this.setState({ timeslots: parseInt(e.target.value) })} /> | |
<span>step = {step}</span> | |
</p> | |
</div> | |
<div style={{ height: '400px' }}> | |
<BigCalendar defaultView="week" events={[]} timeslots={timeslots} step={step} /> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default BigCalendarTimeslotsTest; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment