Skip to content

Commit 3b4f11a

Browse files
committed
TT-107 fix: improve changes
1 parent c243c71 commit 3b4f11a

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

src/app/modules/shared/components/month-picker/month-picker.component.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<div class="card-header">
2-
<div class="row align-items-center">
3-
<div class="col-sm-4">
2+
<div class="row">
3+
<div class="col-4">
44
<button class="btn mr-auto" (click)="changeYear('subtract')">
55
<i class="fa fa-chevron-left"></i>
66
</button>
77
</div>
8-
<div class="col-sm-4">
9-
<p class="text-center year-text">
8+
9+
<div class="col-4 align-item">
10+
<p class="year-text">
1011
{{selectedYearText}}
1112
</p>
1213
</div>
1314

14-
<div class="col-sm-4 text-right">
15-
<button *ngIf="showArrowNext" class="btn ml-auto" (click)="changeYear('add')">
15+
<div class="col-4 text-right">
16+
<button class="btn ml-auto" *ngIf="showArrowNext" (click)="changeYear('add')">
1617
<i class="fa fa-chevron-right"></i>
1718
</button>
1819
</div>
1920
</div>
2021
</div>
2122
<div class="row content-months">
22-
<div class="spacing col-xl-1 col-lg-1 col-md-2 col-sm-2 col-xs-4" *ngFor="let month of months; let i = index">
23+
<div class="spacing col-xl-1 col-lg-1 col-md-2 col-2" *ngFor="let month of months; let i = index">
2324
<button class="btn btn-light btn-block"
2425
[ngClass]="{'btn-primary': isSelectedMonth(i)}"
2526
(click)="selectMonth(i)">

src/app/modules/shared/components/month-picker/month-picker.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
}
2525
}
2626

27+
.align-item {
28+
display: flex;
29+
justify-content: center;
30+
align-items: center;
31+
}
2732
.active {
2833
@include highlight();
2934
border-radius: 0.2em;

src/app/modules/shared/components/month-picker/month-picker.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('MonthPickerComponent', () => {
4444
expect(component.changeYear).toHaveBeenCalled();
4545
expect(component.selectedYearText).toEqual(incrementYear);
4646
expect(component.selectedYearMoment.format('Y')).toEqual(incrementYear);
47-
expect(component.showArrowNext).toEqual(false);
47+
expect(component.showArrowNext).toBe(false, 'false to hidden arrow next in current year');
4848
});
4949

5050
it('should subtract a year to current year', () => {
@@ -56,6 +56,7 @@ describe('MonthPickerComponent', () => {
5656

5757
expect(component.changeYear).toHaveBeenCalled();
5858
expect(component.selectedYearMoment.format('Y')).toEqual(decrementYear);
59+
expect(component.showArrowNext).toBe(true, 'true to show arrow next in previous years');
5960
});
6061

6162
it('selectMonth should call selectDate', () => {

src/app/modules/shared/components/month-picker/month-picker.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class MonthPickerComponent implements OnInit {
4242
const monthIndex = changeAction === 'add' ? 0 : 11;
4343
this.selectMonth(monthIndex);
4444

45-
this.showArrowNext = this.selectedYear < this.currentYear ?? true;
45+
this.showArrowNext = this.selectedYear < this.currentYear;
4646
}
4747

4848
selectMonth(monthIndex: number) {

0 commit comments

Comments
 (0)