Skip to content

Instantly share code, notes, and snippets.

@ehahn9
Created January 10, 2018 20:17
Show Gist options
  • Save ehahn9/5d2b1980c029c7510a04def8c6c83476 to your computer and use it in GitHub Desktop.
Save ehahn9/5d2b1980c029c7510a04def8c6c83476 to your computer and use it in GitHub Desktop.
react-big-calendar timeslots test
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