Skip to content

Commit

Permalink
fix(stepper): clr step button loading (#1647)
Browse files Browse the repository at this point in the history
## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] If applicable, have a visual design approval

## PR Type

What kind of change does this PR introduce?

- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## What is the current behavior?
Stepper button `clrStepButton` have extra padding on the right side when in use with `clrLoading`.

Issue Number: CDE-2499

## What is the new behavior?
Stepper button `clrStepButton` with `clrLoading` follow the regular button behaviour.
 
## Does this PR introduce a breaking change?

- [ ] Yes
- [x] No

## Other information
  • Loading branch information
valentin-mladenov authored Dec 17, 2024
1 parent 77054b2 commit 490dc6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
}

.clr-step-button {
display: inline-block;
margin-top: tokens.$cds-global-space-9;
margin-right: tokens.$cds-global-space-6;
}
Expand Down
2 changes: 1 addition & 1 deletion projects/demo/src/app/stepper/stepper.demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>Stepper with a nested accordion inside it</h2>
<clr-accordion-content>Accordion 2 content</clr-accordion-content>
</clr-accordion-panel>
</clr-accordion>
<button #nextBtn clrStepButton="next">NEXT</button>
<button #nextBtn [clrLoading]="state" clrStepButton="next" (click)="loadingDemo()">NEXT</button>
</ng-template>
</clr-step-content>
</clr-stepper-panel>
Expand Down
10 changes: 10 additions & 0 deletions projects/demo/src/app/stepper/stepper.demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

import { Component, ElementRef, inject, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ClrLoadingState } from '@clr/angular';

@Component({
templateUrl: 'stepper.demo.html',
styleUrls: ['./stepper.demo.scss'],
})
export class StepperDemo {
state: ClrLoadingState = ClrLoadingState.DEFAULT;

showSecondStep = true;
initialStep = 'name';
form: FormGroup = this.getReactiveForm();
Expand All @@ -36,6 +39,13 @@ export class StepperDemo {
};
loading = false;

loadingDemo() {
this.state = ClrLoadingState.LOADING;
setTimeout(() => {
this.state = ClrLoadingState.SUCCESS;
}, 1500);
}

submit() {
console.log('reactive form submit', this.form.value);
}
Expand Down

0 comments on commit 490dc6e

Please sign in to comment.