Skip to content

Commit

Permalink
Go to "today" button on the plannings page
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaVR committed Feb 18, 2019
1 parent e3293d5 commit 5fc593f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/planning/PlanningsPage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@
text-align: right;
}

button:first-of-type {
margin-right: 5px;
button {
margin-left: 5px;

&:first-of-type {
margin-left: 0;
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/components/planning/PlanningsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
this.handleReloadStudents = this.handleReloadStudents.bind(this);
this.handleNextMonth = this.handleNextMonth.bind(this);
this.handlePrevMonth = this.handlePrevMonth.bind(this);
this.handleToday = this.handleToday.bind(this);
this.addInternshipForStudent = this.addInternshipForStudent.bind(this);
this.closeAddInternshipModal = this.closeAddInternshipModal.bind(this);
}
Expand Down Expand Up @@ -110,6 +111,7 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
<div className={styles.buttonsInCalendarComponent}>
<Button icon="left" onClick={this.handlePrevMonth} />
<Button icon="right" onClick={this.handleNextMonth} />
<Button onClick={this.handleToday}>Vandaag</Button>
</div>
<Spin spinning={this.state.arePlannedStudentsLoading}>
<Calendar
Expand Down Expand Up @@ -334,6 +336,13 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
this.doMonthChange("prev");
}

private handleToday(): void {
if (this.calendarRef === null) {
return;
}
this.calendarRef.setValue(moment(), "changePanel");
}

private openAddInternshipModal(student: Student): void {
this.setState({
selectedStudentToPlan: student,
Expand Down

1 comment on commit 5fc593f

@BenjaVR
Copy link
Owner

@BenjaVR BenjaVR commented on 5fc593f Feb 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#55

Please sign in to comment.