Skip to content

Commit

Permalink
Make example’s code cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Apr 25, 2017
1 parent 536c8d0 commit fbc3979
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions examples/src/examples/DisabledDays.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import DayPicker from '../../../src';

import '../../../src/style.css';

function sundays(day) {
return day.getDay() === 0;
}

function saturdays(day) {
return day.getDay() === 6;
}

export default class DisabledDays extends React.Component {
state = {
selectedDay: null,
Expand All @@ -16,18 +24,17 @@ export default class DisabledDays extends React.Component {
});
};
render() {
const { selectedDay } = this.state;
return (
<div>
<DayPicker
enableOutsideDays
selectedDays={selectedDay}
disabledDays={day => day.getDay() === 0 || day.getDay() === 6}
selectedDays={this.state.selectedDay}
disabledDays={[sundays, saturdays]}
onDayClick={this.handleDayClick}
/>
<p>
{selectedDay
? selectedDay.toLocaleDateString()
{this.state.selectedDay
? this.state.selectedDay.toLocaleDateString()
: 'Please select a day 👻'}
</p>
</div>
Expand Down

0 comments on commit fbc3979

Please sign in to comment.