Day picker component of react
Install via npm
npm install rc-day-picker --save
Install via Bower
bower install rc-day-picker --save
Build libs
npm run build
import React, { Component, PropTypes } from 'react';
import ReactDom from 'react-dom';
import DayPicker, {Utils} from '../../../DayPicker.js';
class Demo extends Component {
constructor(...args) {
super(...args);
this.onDayClickHandler = this.onDayClickHandler.bind(this);
}
state = {
selectedDay: null
};
onDayClickHandler(e, day, modifilers) {
if (modifilers.disabled) {
return;
}
this.setState({
selectedDay: modifilers.selected ? null : day,
});
}
render() {
const { selectedDay } = this.state;
return (<DayPicker
numberOfMonths = {1}
canChangeMonth = {true}
selectedDays = {day => Utils.isSameDay(selectedDay, day)}
fixedWeeks = {true}
onDayClick = {this.onDayClickHandler}
/>);
}
}
ReactDom.render(<Demo></Demo>, document.getElementById('root'));