Skip to content

Commit 4ee6013

Browse files
palbizuPatricio Albizu
andauthored
feat: adding icon properties (#1063)
* feat: adding icon properties * feat: adding border settings * feat: adding border settings * feat: fixing inputs Co-authored-by: Patricio Albizu <patricioalbizu@Patricios-MacBook-Pro.local>
1 parent f8d8b7c commit 4ee6013

File tree

7 files changed

+55
-2
lines changed

7 files changed

+55
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const enum IconBorder {
2+
NoBorder = 'no-border',
3+
InsetBorder = 'inset-border',
4+
OutsetBorder = 'outset-border'
5+
}

projects/components/src/icon/icon.component.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,17 @@
5252
height: inherit;
5353
width: inherit;
5454
}
55+
56+
&.no-border {
57+
border-style: none;
58+
}
59+
60+
&.inset-border {
61+
box-sizing: border-box;
62+
}
63+
64+
&.outset-border {
65+
border-width: 2px;
66+
border-style: solid;
67+
}
5568
}

projects/components/src/icon/icon.component.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
22
import { IconRegistryService, IconType } from '@hypertrace/assets-library';
33
import { assertUnreachable } from '@hypertrace/common';
4+
import { IconBorder } from './icon-border';
45
import { IconSize } from './icon-size';
56

67
@Component({
@@ -10,8 +11,13 @@ import { IconSize } from './icon-size';
1011
template: `
1112
<mat-icon
1213
class="ht-icon"
13-
[ngClass]="this.size"
14-
[ngStyle]="{ color: this.color ? this.color : '' }"
14+
[ngClass]="[this.size, this.borderType ? this.borderType : '']"
15+
[ngStyle]="{
16+
color: this.color ? this.color : '',
17+
borderColor: this.borderType !== '${IconBorder.InsetBorder}' && this.borderColor ? this.borderColor : '',
18+
background: this.borderType === '${IconBorder.InsetBorder}' && this.borderColor ? this.borderColor : '',
19+
borderRadius: this.borderRadius ? this.borderRadius : ''
20+
}"
1521
[attr.aria-label]="this.labelToUse"
1622
[htTooltip]="this.showTooltip ? this.labelToUse : undefined"
1723
[fontSet]="this.fontSet"
@@ -27,6 +33,15 @@ export class IconComponent implements OnChanges {
2733
@Input()
2834
public size: IconSize = IconSize.Medium;
2935

36+
@Input()
37+
public borderType: IconBorder = IconBorder.NoBorder;
38+
39+
@Input()
40+
public borderColor?: string;
41+
42+
@Input()
43+
public borderRadius?: string;
44+
3045
@Input()
3146
public label?: string;
3247

projects/components/src/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export * from './header/page/page-header.module';
120120

121121
// Icon
122122
export * from './icon/icon-size';
123+
export * from './icon/icon-border';
123124
export * from './icon/icon.component';
124125
export * from './icon/icon.module';
125126

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
22
import { IconType } from '@hypertrace/assets-library';
33
import { Observable, Subject } from 'rxjs';
4+
import { IconBorder } from '../icon/icon-border';
45
import { SelectOption } from './select-option';
56

67
@Component({
@@ -27,6 +28,15 @@ export class SelectOptionComponent<V> implements OnChanges, SelectOption<V> {
2728
@Input()
2829
public iconColor?: string;
2930

31+
@Input()
32+
public iconBorderType?: IconBorder;
33+
34+
@Input()
35+
public iconBorderColor?: string;
36+
37+
@Input()
38+
public iconBorderRadius?: string;
39+
3040
@Input()
3141
public disabled?: boolean;
3242

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ export interface SelectOption<V> {
44
selectedLabel?: string;
55
icon?: string;
66
iconColor?: string;
7+
iconBorderType?: string;
8+
iconBorderColor?: string;
9+
iconBorderRadius?: string;
710
disabled?: boolean;
811
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ import { SelectSize } from './select-size';
6161
[icon]="this.getPrefixIcon(selected)"
6262
[size]="this.iconSize"
6363
[color]="selected?.iconColor"
64+
[borderType]="selected?.iconBorderType"
65+
[borderColor]="selected?.iconBorderColor"
66+
[borderRadius]="selected?.iconBorderRadius"
6467
>
6568
</ht-icon>
6669
<ht-label class="trigger-label" [label]="selected?.selectedLabel || selected?.label || this.placeholder">
@@ -123,6 +126,9 @@ import { SelectSize } from './select-size';
123126
[icon]="item.icon"
124127
size="${IconSize.Small}"
125128
[color]="item.iconColor"
129+
[borderType]="item?.iconBorderType"
130+
[borderColor]="item?.iconBorderColor"
131+
[borderRadius]="item?.iconBorderRadius"
126132
>
127133
</ht-icon>
128134
<span class="label">{{ item.label }}</span>

0 commit comments

Comments
 (0)