Skip to content

Commit 2388474

Browse files
palbizuPatricio Albizu
andauthored
Adding inputs to time picker (#1343)
* feat: disabled and display Mode input in Time Picker * feat: adding size inputs * feat: adding transparent background to select * feat: fixing comments * feat: fixing comments * feat: fixing comments Co-authored-by: Patricio Albizu <[email protected]>
1 parent f7d76eb commit 2388474

File tree

5 files changed

+55
-7
lines changed

5 files changed

+55
-7
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
padding: 0 8px;
2929
cursor: pointer;
3030
height: 34px;
31+
border-radius: 6px;
32+
33+
&.extra-small {
34+
height: 30px;
35+
}
36+
37+
&.small {
38+
height: 32px;
39+
}
40+
41+
&.large {
42+
height: 44px;
43+
}
3144

3245
&.open {
3346
background-color: $gray-2;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { MultiSelectJustify } from './multi-select-justify';
5353
<div
5454
class="trigger-content"
5555
[style.justify-content]="this.justify"
56-
[ngClass]="[this.triggerLabelDisplayMode, this.popoverOpen ? 'open' : '']"
56+
[ngClass]="[this.triggerLabelDisplayMode, this.popoverOpen ? 'open' : '', this.size]"
5757
#triggerContainer
5858
>
5959
<ht-icon *ngIf="this.icon" [icon]="this.icon" [size]="this.iconSize"></ht-icon>
@@ -63,7 +63,7 @@ import { MultiSelectJustify } from './multi-select-justify';
6363
<span *ngIf="triggerValues.selectedItemsCount > 1" class="trigger-more-items"
6464
>+{{ triggerValues.selectedItemsCount - 1 }}</span
6565
>
66-
<ht-icon class="trigger-icon" icon="${IconType.ChevronDown}" size="${IconSize.Small}"></ht-icon>
66+
<ht-icon class="trigger-icon" icon="${IconType.ChevronDown}" [size]="this.iconSize"></ht-icon>
6767
</div>
6868
</ng-container>
6969
</div>

projects/components/src/select/select-size.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const enum SelectSize {
2+
ExtraSmall = 'extra-small',
23
Small = 'small',
34
Medium = 'medium',
45
Large = 'large'

projects/components/src/time-picker/time-picker.component.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
@import 'mixins';
22

33
.time-picker {
4+
@include disableable;
45
display: flex;
56

67
.time-selector {
78
@include body-1-medium($gray-7);
89
height: 32px;
9-
border: 1px solid $gray-1;
10-
background: $gray-1;
1110
border-radius: 4px;
11+
12+
&.with-background {
13+
border: 1px solid $gray-1;
14+
background: $gray-1;
15+
}
16+
17+
&.with-border {
18+
border: 1px solid $color-border;
19+
border-radius: 6px;
20+
}
1221
}
1322
}
1423

projects/components/src/time-picker/time-picker.component.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { PredefinedTimeService } from '../time-range/predefined-time.service';
99
styleUrls: ['./time-picker.component.scss'],
1010
changeDetection: ChangeDetectionStrategy.OnPush,
1111
template: `
12-
<div class="time-picker">
13-
<ht-popover class="time-selector" [closeOnClick]="true">
12+
<div class="time-picker" [ngClass]="{ disabled: this.disabled }">
13+
<ht-popover class="time-selector" [disabled]="this.disabled" [ngClass]="this.displayMode" [closeOnClick]="true">
1414
<ht-popover-trigger>
1515
<div class="popover-trigger" #popoverTrigger>
1616
<ht-icon
@@ -20,7 +20,13 @@ import { PredefinedTimeService } from '../time-range/predefined-time.service';
2020
*ngIf="this.showTimeTriggerIcon"
2121
></ht-icon>
2222
<ht-label class="trigger-label" *ngIf="this.time" [label]="this.time!.label"></ht-label>
23-
<ht-icon class="trigger-caret" icon="${IconType.ChevronDown}" size="${IconSize.Small}"></ht-icon>
23+
<ht-icon
24+
class="trigger-caret"
25+
icon="${IconType.ChevronDown}"
26+
[size]="
27+
this.iconSize === '${TimePickerIconSize.Regular}' ? '${IconSize.Small}' : '${IconSize.ExtraSmall}'
28+
"
29+
></ht-icon>
2430
</div>
2531
</ht-popover-trigger>
2632
<ht-popover-content>
@@ -45,9 +51,18 @@ export class TimePickerComponent {
4551
@Input()
4652
public time?: Time;
4753

54+
@Input()
55+
public iconSize?: TimePickerIconSize = TimePickerIconSize.Regular;
56+
4857
@Input()
4958
public showTimeTriggerIcon?: boolean = false;
5059

60+
@Input()
61+
public displayMode?: TimePickerDisplayMode = TimePickerDisplayMode.MenuWithBackground;
62+
63+
@Input()
64+
public disabled: boolean = false;
65+
5166
@Output()
5267
public readonly timeChange: EventEmitter<Time> = new EventEmitter();
5368

@@ -67,3 +82,13 @@ export class TimePickerComponent {
6782
this.timeChange.emit(time);
6883
}
6984
}
85+
86+
export const enum TimePickerDisplayMode {
87+
MenuWithBorder = 'with-border',
88+
MenuWithBackground = 'with-background'
89+
}
90+
91+
export const enum TimePickerIconSize {
92+
Small = 'small',
93+
Regular = 'regular'
94+
}

0 commit comments

Comments
 (0)