Skip to content

Commit 6175c39

Browse files
Fix pagination UI (#512)
* fix: (pagination) - fix pagination according to specs * fix: (pagination) - linting * fix: (pagination) - button borders color/radius * fix: (pagination) - ht-popover width equal to select width * fix: (pagination) - remove unused enum * fix: (pagination) - increase dropdown margins * fix: (pagination) - change pagination button component * fix: (pagination) - linting, test * fix: (pagination) - remove unused style * fix: (pagination) - refactor set min width of dropdown * fix: (pagination) - change buttons component * fix(pagination-ui): remove unused styles * fix(select): add style to select option, remove unused styles * fix(select): trigger container element for ref * fix(paginaion-ui): remove unused ref Co-authored-by: Dmitriy Potychkin <dmitriy.traceable.ai>
1 parent 96ec23a commit 6175c39

File tree

5 files changed

+45
-34
lines changed

5 files changed

+45
-34
lines changed

projects/components/src/paginator/paginator.component.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
}
1717

1818
.page-size-select {
19-
min-width: 86px;
2019
margin-left: 12px;
2120
}
2221

@@ -28,16 +27,22 @@
2827
.previous-button {
2928
::ng-deep {
3029
.button {
31-
border-radius: 4px 0 0 4px;
30+
width: 32px;
31+
32+
border-radius: 6px 0 0 6px;
33+
border-color: $gray-2;
3234
}
3335
}
3436
}
3537

3638
.next-button {
3739
::ng-deep {
3840
.button {
39-
border-radius: 0 4px 4px 0;
41+
width: 32px;
4042
margin-left: -1px;
43+
44+
border-radius: 0 6px 6px 0;
45+
border-color: $gray-2;
4146
}
4247
}
4348
}

projects/components/src/paginator/paginator.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { IconType } from '@hypertrace/assets-library';
1111
import { TypedSimpleChanges } from '@hypertrace/common';
1212
import { Observable } from 'rxjs';
13-
import { ButtonStyle } from '../button/button';
13+
import { ButtonSize, ButtonStyle } from '../button/button';
1414
import { PageEvent } from './page.event';
1515
import { PaginationProvider } from './paginator-api';
1616

@@ -25,14 +25,13 @@ import { PaginationProvider } from './paginator-api';
2525
label="{{ this.firstItemNumberForPage() }}-{{ this.lastItemNumberForPage() }} of {{ this.totalItems }}"
2626
>
2727
</ht-label>
28-
2928
<div class="pagination-buttons">
30-
<!-- TODO: Change ToggleButtonComponent to be more generic ButtonGroupComponent to accommodate this use case -->
3129
<ht-button
3230
class="button previous-button"
3331
htTooltip="Go to previous page"
3432
display="${ButtonStyle.Bordered}"
35-
icon="${IconType.Previous}"
33+
size="${ButtonSize.Small}"
34+
icon="${IconType.ArrowLeft}"
3635
[disabled]="!this.hasPrevPage()"
3736
(click)="this.gotoPreviousPage()"
3837
>
@@ -41,15 +40,14 @@ import { PaginationProvider } from './paginator-api';
4140
class="button next-button"
4241
htTooltip="Go to next page"
4342
display="${ButtonStyle.Bordered}"
44-
icon="${IconType.Next}"
43+
size="${ButtonSize.Small}"
44+
icon="${IconType.ArrowRight}"
4545
[disabled]="!this.hasNextPage()"
4646
(click)="this.gotoNextPage()"
4747
>
4848
</ht-button>
4949
</div>
50-
5150
<ht-label class="label" label="Rows per Page:"></ht-label>
52-
5351
<div class="page-size-select" *ngIf="this.pageSizeOptions.length">
5452
<ht-select [selected]="this.pageSize" (selectedChange)="this.onPageSizeChange($event)" showBorder="true">
5553
<ht-select-option *ngFor="let pageSize of this.pageSizeOptions" [value]="pageSize" [label]="pageSize">

projects/components/src/paginator/paginator.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { NgModule } from '@angular/core';
33
import { ButtonModule } from '../button/button.module';
44
import { LabelModule } from '../label/label.module';
55
import { SelectModule } from '../select/select.module';
6+
import { ToggleButtonModule } from '../toggle-button-group/toggle-button.module';
67
import { TooltipModule } from '../tooltip/tooltip.module';
78
import { PaginatorComponent } from './paginator.component';
89

910
@NgModule({
1011
declarations: [PaginatorComponent],
11-
imports: [CommonModule, SelectModule, LabelModule, ButtonModule, TooltipModule],
12+
imports: [CommonModule, SelectModule, LabelModule, ToggleButtonModule, ButtonModule, TooltipModule],
1213
exports: [PaginatorComponent]
1314
})
1415
export class PaginatorModule {}

projects/components/src/select/select.component.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
}
5555
}
5656

57+
.trigger-container {
58+
width: 100%;
59+
height: 100%;
60+
}
61+
5762
.trigger-content {
5863
display: flex;
5964
align-items: center;
@@ -118,7 +123,6 @@
118123

119124
.select-content {
120125
@include dropdown();
121-
min-width: 120px;
122126
max-height: 204px;
123127

124128
.select-option {

projects/components/src/select/select.component.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,35 @@ import { SelectSize } from './select-size';
4545
[ngSwitch]="this.triggerDisplayMode"
4646
>
4747
<ht-popover-trigger>
48-
<div
49-
*ngSwitchCase="'${SelectTriggerDisplayMode.MenuWithBorder}'"
50-
class="trigger-content menu-with-border"
51-
[ngClass]="[this.justifyClass]"
52-
>
53-
<ht-icon *ngIf="this.icon" class="trigger-prefix-icon" [icon]="this.icon" [size]="this.iconSize"> </ht-icon>
54-
<ht-label class="trigger-label" [label]="selected?.label || this.placeholder"> </ht-label>
55-
<ht-icon class="trigger-icon" icon="${IconType.ChevronDown}" size="${IconSize.ExtraSmall}"> </ht-icon>
56-
</div>
57-
<div
58-
*ngSwitchCase="'${SelectTriggerDisplayMode.Icon}'"
59-
class="trigger-content icon-only"
60-
[ngClass]="this.selected !== undefined ? 'selected' : ''"
61-
>
62-
<ht-icon
63-
class="icon"
64-
*ngIf="this.icon"
65-
[icon]="this.icon"
66-
[size]="this.iconSize"
67-
[htTooltip]="this.selected?.label || this.placeholder"
48+
<div class="trigger-container" #triggerContainer>
49+
<div
50+
*ngSwitchCase="'${SelectTriggerDisplayMode.MenuWithBorder}'"
51+
class="trigger-content menu-with-border"
52+
[ngClass]="[this.justifyClass]"
53+
>
54+
<ht-icon *ngIf="this.icon" class="trigger-prefix-icon" [icon]="this.icon" [size]="this.iconSize">
55+
</ht-icon>
56+
<ht-label class="trigger-label" [label]="selected?.label || this.placeholder"> </ht-label>
57+
<ht-icon class="trigger-icon" icon="${IconType.ChevronDown}" size="${IconSize.ExtraSmall}"> </ht-icon>
58+
</div>
59+
<div
60+
*ngSwitchCase="'${SelectTriggerDisplayMode.Icon}'"
61+
class="trigger-content icon-only"
62+
[ngClass]="this.selected !== undefined ? 'selected' : ''"
6863
>
69-
</ht-icon>
64+
<ht-icon
65+
class="icon"
66+
*ngIf="this.icon"
67+
[icon]="this.icon"
68+
[size]="this.iconSize"
69+
[htTooltip]="this.selected?.label || this.placeholder"
70+
>
71+
</ht-icon>
72+
</div>
7073
</div>
7174
</ht-popover-trigger>
7275
<ht-popover-content>
73-
<div class="select-content">
76+
<div class="select-content" [ngStyle]="{ 'minWidth.px': triggerContainer.offsetWidth }">
7477
<div
7578
*ngFor="let item of items"
7679
(click)="this.onSelectionChange(item)"

0 commit comments

Comments
 (0)