-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated React version and added option to get the current month's data #36
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing unit tests, which is the most crucial thing here. Also left out quite some comments & console logs around, which I'd advise you to avoid.
}; | ||
} | ||
|
||
componentDidUpdate( prevProps, prevState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this entire method, it's doing nothing really.
@@ -51,6 +64,36 @@ export default class Calendar extends React.Component { | |||
); | |||
} | |||
|
|||
// _verifyWeeksChange( weeks ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this to be commented out? If not needed, remove please.
@@ -60,10 +103,17 @@ export default class Calendar extends React.Component { | |||
const { | |||
timeslots, | |||
initialDate, | |||
onMonthChange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prop is not being used here, I only see it in this._onMonthChange
, so it's an unused var.
// this.setState({ | ||
// weeksStart: weeks[0], | ||
// weeksEnd: weeks[weeks.length - 1] | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all this comments.
@@ -45,6 +45,7 @@ export default class App extends React.Component { | |||
console.log('Last selected timeslot:'); | |||
console.log(lastSelected); | |||
} } | |||
onMonthChange = { (month) => {console.log(month)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no point on doing this (?). If what you're looking to see is whether this works or not, write unit tests instead.
this.startDate = startDate; | ||
this.endDate = endDate; | ||
|
||
this.props.onMonthChange({ startDate, endDate }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use destructuring here:
const { onMonthChange } = this.props
// } | ||
|
||
_onMonthChange(weeks) { | ||
const startingWeek = weeks[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [startingWeek] = weeks
No description provided.