Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(design)!: change the diameter property of loading icon to a string instead of number #3341

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/design/button/src/button/button-base.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ng-content select="[daffPrefix]"></ng-content>
}
@if (loading) {
<daff-loading-icon [diameter]="24"></daff-loading-icon>
<daff-loading-icon diameter="24px"></daff-loading-icon>
} @else {
<span class="daff-button__content"><ng-content></ng-content></span>
}
Expand Down
2 changes: 1 addition & 1 deletion libs/design/loading-icon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class CustomComponentModule { }
> This method is deprecated. It's recommended to update all custom components to standalone.

## Diameter
The diameter of a loading icon can be defined by using the `diameter` property. By default, the diameter is set to `60`.
The diameter of a loading icon can be defined by using the `diameter` property. By default, the diameter is set to `60px`.

<design-land-example-viewer-container example="loading-icon-diameter"></design-land-example-viewer-container>

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<daff-loading-icon [diameter]="100"></daff-loading-icon>
<daff-loading-icon diameter="100px"></daff-loading-icon>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DaffLoadingIconComponent } from './loading-icon.component';
})
class WrapperComponent {
color: DaffPalette;
diameter = 60;
diameter = '60';
}

describe('@daffodil/design/loading-icon | DaffLoadingIconComponent', () => {
Expand Down Expand Up @@ -61,11 +61,11 @@ describe('@daffodil/design/loading-icon | DaffLoadingIconComponent', () => {
});

it('has a default value of 60 for the diameter', () => {
expect(component.diameter).toEqual(60);
expect(component.diameter).toEqual('60');
});

it('can take a `diameter` as input which sets max-width on the `daff-loading-icon` host', () => {
wrapper.diameter = 50;
wrapper.diameter = '50px';
fixture.detectChanges();
expect(de.nativeElement.style.maxWidth).toEqual('50px');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DaffLoadingIconComponent {
/**
* The (pixel) diameter of the animation
*/
@Input() diameter = 60;
@Input() diameter = '60px';

/**
* @docs-private
Expand All @@ -38,6 +38,6 @@ export class DaffLoadingIconComponent {
* @docs-private
*/
@HostBinding('style.max-width') get maxWidth() {
return this.diameter + 'px';
return this.diameter;
}
}
Loading