Skip to content

Commit f8f9e94

Browse files
authored
feat(design)!: remove the diameter property of loading icon (#3341)
1 parent 90d5689 commit f8f9e94

File tree

10 files changed

+14
-66
lines changed

10 files changed

+14
-66
lines changed

apps/design-land/src/app/loading-icon/loading-icon.component.html

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ <h1>Loading Icon</h1>
44
<h2>Overview</h2>
55
<p>Loading icons are used to indicate to users that an event is ocurring and is still in progress. They should only be used for short loading processes. For events that can take a considerable amount of time, use the <a routerLink="/progress-bar">Progress Bar</a> component instead.</p>
66

7-
<h2>Diameter</h2>
8-
<p>The diameter of a loading icon can be defined by using the <code>diameter</code> property. By default, the diameter is set to <code>60</code>.</p>
9-
10-
<design-land-example-viewer-container example="loading-icon-diameter"></design-land-example-viewer-container>
11-
127
<h2>Theming</h2>
138
<p>The loading icon color is defined by using the <code>color</code> property. By default, the color is set to <code>primary</code>. This can be changed to one of the supported colors.</p>
149

libs/design/button/src/button/button-base.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ng-content select="[daffPrefix]"></ng-content>
33
}
44
@if (loading) {
5-
<daff-loading-icon [diameter]="24"></daff-loading-icon>
5+
<daff-loading-icon class="daff-button__loading"></daff-loading-icon>
66
} @else {
77
<span class="daff-button__content"><ng-content></ng-content></span>
88
}

libs/design/button/src/button/button-base.scss

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
display: inline-flex;
77
justify-content: center;
88
align-items: center;
9-
gap: 8px;
9+
gap: 0.5rem;
1010
appearance: none;
1111
border: none;
12-
border-radius: 4px;
12+
border-radius: 0.25rem;
1313
position: relative;
1414
text-align: center;
1515
text-decoration: none;
@@ -25,6 +25,10 @@
2525
z-index: 2;
2626
}
2727

28+
.daff-button__loading {
29+
max-width: 1.5rem;
30+
}
31+
2832
.daff-button__content {
2933
@include t.text-truncate();
3034
}

libs/design/loading-icon/README.md

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ export class CustomComponentModule { }
4545

4646
> This method is deprecated. It's recommended to update all custom components to standalone.
4747
48-
## Diameter
49-
The diameter of a loading icon can be defined by using the `diameter` property. By default, the diameter is set to `60`.
50-
51-
<design-land-example-viewer-container example="loading-icon-diameter"></design-land-example-viewer-container>
52-
5348
## Theming
5449
The loading icon color is defined by using the `color` property. By default, the color is set to `primary`. This can be changed to one of the supported colors.
5550

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { LoadingIconColorComponent } from './loading-icon-color/loading-icon-color.component';
2-
import { LoadingIconDiameterComponent } from './loading-icon-diameter/loading-icon-diameter.component';
32

43
export const LOADING_ICON_EXAMPLES = [
54
LoadingIconColorComponent,
6-
LoadingIconDiameterComponent,
75
];

libs/design/loading-icon/examples/src/loading-icon-diameter/loading-icon-diameter.component.html

-1
This file was deleted.

libs/design/loading-icon/examples/src/loading-icon-diameter/loading-icon-diameter.component.ts

-18
This file was deleted.

libs/design/loading-icon/src/loading-icon/loading-icon.component.scss

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $angle: 270 - $max-percentage-fill * 360;
1616
:host {
1717
display: flex;
1818
width: 100%;
19+
max-width: 4rem;
1920
}
2021

2122
.daff-loading-icon {

libs/design/loading-icon/src/loading-icon/loading-icon.component.spec.ts

+6-19
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ import { DaffPalette } from '@daffodil/design';
1414
import { DaffLoadingIconComponent } from './loading-icon.component';
1515

1616
@Component({
17-
template: '<daff-loading-icon [color]="color" [diameter]="diameter"></daff-loading-icon>',
17+
template: '<daff-loading-icon [color]="color"></daff-loading-icon>',
1818
standalone: true,
1919
imports: [
2020
DaffLoadingIconComponent,
2121
],
2222
})
2323
class WrapperComponent {
2424
color: DaffPalette;
25-
diameter = 60;
2625
}
2726

2827
describe('@daffodil/design/loading-icon | DaffLoadingIconComponent', () => {
@@ -44,30 +43,18 @@ describe('@daffodil/design/loading-icon | DaffLoadingIconComponent', () => {
4443
fixture = TestBed.createComponent(WrapperComponent);
4544
wrapper = fixture.componentInstance;
4645
de = fixture.debugElement.query(By.css('daff-loading-icon'));
47-
component = fixture.debugElement.query(By.css('daff-loading-icon')).componentInstance;
46+
component = de.componentInstance;
4847
fixture.detectChanges();
4948
});
5049

5150
it('should create', () => {
5251
expect(wrapper).toBeTruthy();
5352
});
5453

55-
describe('<daff-loading-icon>', () => {
56-
it('should add a class of "daff-loading-icon" to the host element', () => {
57-
expect(de.classes).toEqual(jasmine.objectContaining({
58-
'daff-loading-icon': true,
59-
}));
60-
});
61-
});
62-
63-
it('has a default value of 60 for the diameter', () => {
64-
expect(component.diameter).toEqual(60);
65-
});
66-
67-
it('can take a `diameter` as input which sets max-width on the `daff-loading-icon` host', () => {
68-
wrapper.diameter = 50;
69-
fixture.detectChanges();
70-
expect(de.nativeElement.style.maxWidth).toEqual('50px');
54+
it('should add a class of "daff-loading-icon" to the host element', () => {
55+
expect(de.classes).toEqual(jasmine.objectContaining({
56+
'daff-loading-icon': true,
57+
}));
7158
});
7259

7360
it('should take color as an input', () => {

libs/design/loading-icon/src/loading-icon/loading-icon.component.ts

-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
Component,
33
ChangeDetectionStrategy,
4-
Input,
54
HostBinding,
65
} from '@angular/core';
76

@@ -24,20 +23,8 @@ import { DaffColorableDirective } from '@daffodil/design';
2423
standalone: true,
2524
})
2625
export class DaffLoadingIconComponent {
27-
28-
/**
29-
* The (pixel) diameter of the animation
30-
*/
31-
@Input() diameter = 60;
32-
3326
/**
3427
* @docs-private
3528
*/
3629
@HostBinding('class.daff-loading-icon') class = true;
37-
/**
38-
* @docs-private
39-
*/
40-
@HostBinding('style.max-width') get maxWidth() {
41-
return this.diameter + 'px';
42-
}
4330
}

0 commit comments

Comments
 (0)