Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/new-grapes-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Stepper: Remove interactivity on inactive next steps.
11 changes: 11 additions & 0 deletions .changeset/rare-kids-drum.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could combine both changesets so people know which component is concerned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was me who asked to separate the changeset because it seems strange to me to have "clarified how to use the stepper" in the styles changelog... But it is true that the second changelog does not specify which component is affected by the changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a convention for the context, or is it fine like this?

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@swisspost/design-system-styles': patch
---

Stepper:

- Normalize font styles and weights.
- Position the step label under the the badge on small viewport.
Comment thread
imagoiq marked this conversation as resolved.
Outdated
- Center the step label when this text is multiline.
Comment thread
imagoiq marked this conversation as resolved.
Outdated
- Use hover step label color only on interactive step.
- Add contrasted step label color on focus.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* Copyright 2021 by Swiss Post, Information Technology
*/

import {Component} from '@angular/core';
import { Component } from '@angular/core';

const codeTemplate = require('!!raw-loader!../stepper-demo/stepper-demo.component.html').default;
const codeController = require('!!raw-loader!../stepper-demo/stepper-demo.component.ts').default;

@Component({
templateUrl: 'stepper-demo-page.component.html'
templateUrl: 'stepper-demo-page.component.html',
})
export class StepperDemoPageComponent {
codeTemplate = codeTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2 class="visually-hidden">Order progress, step 3 of 4</h2>
<span class="visually-hidden">Complete:</span>
{{ step }}
</a>
<span class="stepper-link" *ngIf="i >= currentIndex" (click)="currentIndex = i">
<span class="stepper-link" *ngIf="i >= currentIndex">
{{ step }}
</span>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Component} from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-stepper-demo',
templateUrl: 'stepper-demo.component.html'
templateUrl: 'stepper-demo.component.html',
})
export class StepperDemoComponent {
steps = ['Sender', 'Product', 'Other details', 'Order summary'];
Expand Down
10 changes: 3 additions & 7 deletions packages/styles/src/components/stepper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@
text-decoration: none;
color: stepper.$stepper-link-color;
transition: color 250ms;
text-align: center;

.stepper-item[aria-current] > & {
color: stepper.$stepper-link-current-color;
font-size: stepper.$stepper-link-current-font-size;
font-weight: stepper.$stepper-link-current-font-weight;
}

&:hover {
@at-root a:hover#{&},
:focus-visible#{&} {
color: stepper.$stepper-link-hover-color;
}

Expand All @@ -127,12 +129,6 @@

@include media-breakpoint-down(rg) {
.stepper-item {
&[aria-current] .stepper-link {
position: absolute;
bottom: 0;
left: 0;
}

&:not([aria-current]) .stepper-link {
overflow: hidden;
white-space: nowrap;
Expand Down
6 changes: 3 additions & 3 deletions packages/styles/src/variables/components/_stepper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ $stepper-bar-height: spacing.$size-micro;
$stepper-indicator-height: spacing.$size-bigger-big;
$stepper-indicator-border-width: spacing.$size-micro;
$stepper-indicator-border-color: color.$white;
$stepper-indicator-font-size: type.$font-size-bigger-regular;
$stepper-indicator-font-weight: type.$font-weight-bold;
$stepper-indicator-font-size: type.$font-size-regular;
$stepper-indicator-font-weight: type.$font-weight-base;
$stepper-indicator-bg: color.$yellow;
$stepper-indicator-color: color.$black;
$_stepper-indicator-check-icon: icon-fn.get-colored-svg-url('2105', $stepper-indicator-color);
Expand All @@ -32,5 +32,5 @@ $stepper-link-gap: spacing.$size-mini;
$stepper-link-color: color.$gray-60;
$stepper-link-hover-color: color.$black;
$stepper-link-current-color: color.$black;
$stepper-link-current-font-size: type.$font-size-bigger-regular;
$stepper-link-current-font-size: type.$font-size-regular;
$stepper-link-current-font-weight: type.$font-weight-bold;