-
Notifications
You must be signed in to change notification settings - Fork 14
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(docs): add stepper documentation #2556
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-documentation': minor | ||
--- | ||
|
||
Added a documentation page for the post stepper component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/documentation/src/shared/post-component-demo-link.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<a | ||
className="btn btn-rg btn-secondary btn-animated" | ||
href={`https://archive.design-system.post.ch/#/post-samples/${props.component}`} | ||
target="_blank" | ||
rel="nofollow noopener noreferrer" | ||
> | ||
<span>See archived documentation</span> | ||
</a> |
18 changes: 18 additions & 0 deletions
18
packages/documentation/src/stories/components/stepper/stepper-component.sample.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'post-stepper', | ||
templateUrl: 'template.html', | ||
}) | ||
export class StepperDemoComponent { | ||
steps = ['Sender', 'Product', 'Other details', 'Order summary']; | ||
currentIndex = 2; | ||
|
||
isCurrent(step: string): boolean { | ||
return step === this.steps[this.currentIndex]; | ||
} | ||
|
||
getPathTo(step: string): string { | ||
return step.toLowerCase().split(' ').join('-'); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/documentation/src/stories/components/stepper/stepper-template.sample.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="stepper-container" role="group"> | ||
<h2 class="visually-hidden">Order progress, step 3 of 4</h2> | ||
<ngb-progressbar | ||
[max]="steps.length - 1" | ||
[value]="currentIndex" | ||
class="stepper-bar" | ||
aria-hidden="true" | ||
></ngb-progressbar> | ||
|
||
<ol class="stepper" role="list"> | ||
<li | ||
*ngFor="let step of steps; index as i" | ||
[attr.aria-current]="isCurrent(step) ? 'step' : undefined" | ||
class="stepper-item" | ||
> | ||
<a *ngIf="i < currentIndex" class="stepper-link" (click)="currentIndex = i" href="#"> | ||
<span class="visually-hidden">Complete:</span> | ||
{{ step }} | ||
</a> | ||
<span class="stepper-link" *ngIf="i >= currentIndex">{{ step }}</span> | ||
</li> | ||
</ol> | ||
</div> |
53 changes: 53 additions & 0 deletions
53
packages/documentation/src/stories/components/stepper/stepper.docs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Meta, Source } from '@storybook/blocks'; | ||
import { PostTabs, PostTabHeader, PostTabPanel } from '@swisspost/design-system-components-react'; | ||
import StylesPackageImport from '../../../shared/styles-package-import.mdx'; | ||
import PostComponentDemoLink from '../../../shared/post-component-demo-link.mdx'; | ||
import NgbComponentImport from '../../../shared/nb-bootstrap/ngb-component-import.mdx'; | ||
import * as stepperStories from './stepper.stories'; | ||
import stepperTemplate from './stepper-template.sample.html?raw'; | ||
import stepperComponent from './stepper-component.sample?raw'; | ||
|
||
<Meta of={stepperStories} /> | ||
|
||
<div className="d-flex align-items-center justify-content-between"> | ||
# Stepper | ||
|
||
<PostComponentDemoLink component="stepper" /> | ||
</div> | ||
|
||
<p className="lead">Conveys progress through numbered steps.</p> | ||
|
||
<div className="alert alert-info mb-bigger-big"> | ||
<p className="alert-heading">The stepper uses ng-bootstrap's progressbar component.</p> | ||
</div> | ||
|
||
<ul> | ||
<li> | ||
<a href="#component-import" target="_self">Component Import</a> | ||
</li> | ||
<li> | ||
<a href="#style-imports" target="_self">Style Imports</a> | ||
</li> | ||
<li> | ||
<a href="#example" target="_self">Example</a> | ||
</li> | ||
</ul> | ||
|
||
<NgbComponentImport module="NgbProgressbarModule" /> | ||
|
||
<StylesPackageImport components={["progress", "stepper"]} /> | ||
|
||
## Example | ||
|
||
<PostTabs> | ||
<PostTabHeader slot="tabs" panel="template">template.html</PostTabHeader> | ||
<PostTabPanel name="template"> | ||
<Source code={stepperTemplate} language="html"/> | ||
</PostTabPanel> | ||
|
||
<PostTabHeader slot="tabs" panel="component">component.ts</PostTabHeader> | ||
<PostTabPanel name="component"> | ||
<Source code={stepperComponent} language="typescript"/> | ||
</PostTabPanel> | ||
</PostTabs> | ||
|
16 changes: 16 additions & 0 deletions
16
packages/documentation/src/stories/components/stepper/stepper.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Meta, StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
import { BADGE } from '../../../../.storybook/constants'; | ||
|
||
const meta: Meta = { | ||
title: 'Components/Stepper', | ||
parameters: { | ||
badges: [BADGE.WEB_COMPONENT_CANDIDATE], | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: StoryObj = { | ||
render: () => html``, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These links are not working properly:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a ticket to address this problem, because it's happening not only here and its already live 😢
#2575