-
Notifications
You must be signed in to change notification settings - Fork 0
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
Master #3
base: hw2
Are you sure you want to change the base?
Conversation
Merged corrected result from hw1 branch to master
Added routes and basic design
|
||
export default class CalendarDay extends React.Component { | ||
render() { | ||
let curDay = new Date(this.props.info.year, this.props.info.month, this.props.info.day); |
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.
move info to own variable, you using this.props.info
too much.
</Header> | ||
<Sidebar> | ||
<button className='btn' onClick={() => this.props.chgDay(-1)}>Prev day</button> | ||
<button className='btn' onClick={() => this.props.chgDay(-2)}>Next day</button> |
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.
why next day is -2
?
if (numOfDaysFromBegOfWeek !== 6) { | ||
for (let j = 1; j <= numOfDaysFromBegOfWeek + 1; j++) { | ||
arr.push({ | ||
date: (-1) * j, |
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.
why not date: -j
?
|
||
} | ||
|
||
changeMonth = (what) => { |
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 function is totally counter-intuitive, please refactor this. :)
} | ||
} | ||
|
||
isOkDay = (day) => { |
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 think you can reduce size of this function if you investigate working with Date objects more :)
rewrote project using classes