Skip to content

Commit 7405086

Browse files
Patricio AlbizuPatricio Albizu
authored andcommitted
feat: adding border settings
1 parent 67cbc26 commit 7405086

File tree

7 files changed

+39
-6
lines changed

7 files changed

+39
-6
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: 8 additions & 3 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,10 +11,11 @@ import { IconSize } from './icon-size';
1011
template: `
1112
<mat-icon
1213
class="ht-icon"
13-
[ngClass]="this.size"
14+
[ngClass]="[this.size, this.borderType ? this.borderType : '']"
1415
[ngStyle]="{
1516
color: this.color ? this.color : '',
16-
border: this.border ? this.border : '',
17+
borderColor: this.borderType !== '${IconBorder.InsetBorder}' && this.borderColor ? this.borderColor : '',
18+
background: this.borderType === '${IconBorder.InsetBorder}' && this.borderColor ? this.borderColor : '',
1719
borderRadius: this.borderRadius ? this.borderRadius : ''
1820
}"
1921
[attr.aria-label]="this.labelToUse"
@@ -32,7 +34,10 @@ export class IconComponent implements OnChanges {
3234
public size: IconSize = IconSize.Medium;
3335

3436
@Input()
35-
public border?: string;
37+
public borderType: IconBorder = IconBorder.NoBorder;
38+
39+
@Input()
40+
public borderColor?: string;
3641

3742
@Input()
3843
public borderRadius?: string;

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: 5 additions & 1 deletion
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({
@@ -28,7 +29,10 @@ export class SelectOptionComponent<V> implements OnChanges, SelectOption<V> {
2829
public iconColor?: string;
2930

3031
@Input()
31-
public iconBorder?: string;
32+
public iconBorderType?: IconBorder;
33+
34+
@Input()
35+
public iconBorderColor?: string;
3236

3337
@Input()
3438
public iconBorderRadius?: string;

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ import { SelectSize } from './select-size';
6161
[icon]="this.getPrefixIcon(selected)"
6262
[size]="this.iconSize"
6363
[color]="selected?.iconColor"
64-
[border]="selected?.iconBorder"
64+
[borderType]="selected.iconBorderType"
65+
[borderColor]="selected?.iconBorderColor"
6566
[borderRadius]="selected?.iconBorderRadius"
6667
>
6768
</ht-icon>
@@ -125,7 +126,8 @@ import { SelectSize } from './select-size';
125126
[icon]="item.icon"
126127
size="${IconSize.Small}"
127128
[color]="item.iconColor"
128-
[border]="item.iconBorder"
129+
[borderType]="item.iconBorderType"
130+
[borderColor]="item.iconBorderColor"
129131
[borderRadius]="item.iconBorderRadius"
130132
>
131133
</ht-icon>

0 commit comments

Comments
 (0)