Skip to content

Commit bee164a

Browse files
authored
chore(docs): common installation instruction for web components (#6514)
## 📄 Description - Removed all of the repetitive installation instructions on web components and created a common section for it. - Added the instruction on web components that didn't have any. ## 🚀 Demo If applicable, please add a screenshot or video to illustrate the changes. --- ## 🔮 Design review - [ ] Design review done - [X] No design review needed ## 📝 Checklist - ✅ My code follows the style guidelines of this project - 🛠️ I have performed a self-review of my own code - 📄 I have made corresponding changes to the documentation - ⚠️ My changes generate no new warnings or errors - 🧪 I have added tests that prove my fix is effective or that my feature works - ✔️ New and existing unit tests pass locally with my changes
1 parent 287bf34 commit bee164a

File tree

26 files changed

+71
-61
lines changed

26 files changed

+71
-61
lines changed

.changeset/tired-horses-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@swisspost/design-system-documentation': patch
3+
---
4+
5+
Added common installation instructions on every web component documentation page.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Installation
2+
3+
<>
4+
{/* eslint-disable-next-line no-undef */}
5+
{props.subtitle && <h3>{props.subtitle}</h3>}
6+
7+
{/* eslint-disable-next-line no-undef */}
8+
The <code>{props.component}</code> element is part of the `@swisspost/design-system-components` package.
9+
For more information, read the [getting started with components guide](/?path=/docs/edfb619b-fda1-4570-bf25-20830303d483--docs).
10+
11+
</>

packages/documentation/src/stories/components/accordion/accordion.docs.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Canvas, Controls, Meta, Source } from '@storybook/addon-docs/blocks';
22
import * as accordionStories from './accordion.stories';
33
import * as accordionItemStories from './accordion-item.stories';
44
import SampleCustomTrigger from './accordion-custom-trigger.sample?raw';
5+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
56

67
<Meta of={accordionStories} />
78

@@ -27,10 +28,7 @@ It is used to manage how content is shown and hidden across a set of collapsible
2728

2829
<Controls of={accordionItemStories.Default} />
2930

30-
## Installation
31-
32-
The `<post-accordion>` element is part of the `@swisspost/design-system-components` package.
33-
For more information, read the [getting started with components guide](/?path=/docs/edfb619b-fda1-4570-bf25-20830303d483--docs).
31+
<ComponentsPackageInstall component="<post-accordion>" />
3432

3533
## Examples
3634

packages/documentation/src/stories/components/avatar/avatar.docs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Canvas, Controls, Meta, Source } from '@storybook/addon-docs/blocks';
22
import * as AvatarPictureStories from './avatar.stories';
33
import AvatarSample from './avatar.sample.scss?raw';
4+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
45

56
<Meta of={AvatarPictureStories} />
67

@@ -17,6 +18,8 @@ import AvatarSample from './avatar.sample.scss?raw';
1718
<Canvas of={AvatarPictureStories.Default} sourceState="shown" />
1819
<Controls of={AvatarPictureStories.Default} />
1920

21+
<ComponentsPackageInstall component="<post-avatar>" />
22+
2023
## Interactive Wrapper Element
2124

2225
### Anchor

packages/documentation/src/stories/components/back-to-top/back-to-top.docs.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Meta, Source } from '@storybook/addon-docs/blocks';
22
import * as BackToTopStories from './back-to-top.stories.ts';
33
import BackToTop from './back-to-top.sample.html?raw';
4+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
45

56
<Meta of={BackToTopStories} />
67

@@ -22,10 +23,7 @@ import BackToTop from './back-to-top.sample.html?raw';
2223
the Back to Top button.
2324
</post-banner>
2425

25-
## Installation
26-
27-
The `<post-back-to-top>` element is part of the `@swisspost/design-system-components` package.
28-
For more information, read the [getting started with components guide](/?path=/docs/edfb619b-fda1-4570-bf25-20830303d483--docs).
26+
<ComponentsPackageInstall component="<post-back-to-top>" />
2927

3028
## Examples
3129

packages/documentation/src/stories/components/banner/banner.docs.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Canvas, Controls, Meta, Source } from '@storybook/addon-docs/blocks';
22
import * as BannerStories from './banner.stories';
33
import BannerDismissSample from './banner-dismiss.sample?raw';
4+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
45

56
<Meta of={BannerStories} />
67

@@ -19,10 +20,7 @@ import BannerDismissSample from './banner-dismiss.sample?raw';
1920

2021
<Controls of={BannerStories.Default} />
2122

22-
## Installation
23-
24-
The `<post-banner>` element is part of the `@swisspost/design-system-components` package.
25-
For more information, read the [getting started with components guide](/?path=/docs/edfb619b-fda1-4570-bf25-20830303d483--docs).
23+
<ComponentsPackageInstall component="<post-banner>" />
2624

2725
## Examples
2826

packages/documentation/src/stories/components/breadcrumb/breadcrumbs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
22
import * as BreadcrumbsStories from './breadcrumbs.stories';
3+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
34

45
<Meta of={BreadcrumbsStories} />
56

@@ -20,6 +21,8 @@ The `<post-breadcrumbs>` is a container for `<post-breadcrumb-item>` components,
2021
<Canvas of={BreadcrumbsStories.Default} sourceState="shown" />
2122
<Controls of={BreadcrumbsStories.Default} />
2223

24+
<ComponentsPackageInstall component="<post-breadcrumbs>" />
25+
2326
## Concatenated Breadcrumbs
2427

2528
When space is constrained, the `<post-breadcrumbs>` concatenates middle items into a dropdown menu.

packages/documentation/src/stories/components/button-close/button-close.docs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Canvas, Controls, Meta } from '@storybook/addon-docs/blocks';
22
import * as CloseButtonStories from './button-close.stories';
3+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
34

45
<Meta of={CloseButtonStories} />
56

@@ -20,3 +21,5 @@ The value inside the `<post-closebutton>` element will be rendered inside the bu
2021
<div className="hide-col-default">
2122
<Controls of={CloseButtonStories.Default} />
2223
</div>
24+
25+
<ComponentsPackageInstall component="<post-closebutton>" />

packages/documentation/src/stories/components/card-control/card-control.docs.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import firefoxFallbackSnippet from './standard-html/card-control-firefox-fallbac
66

77
import * as CardControlStories from './web-component/card-control.stories';
88
import SampleCardControlMethods from './web-component/card-control-methods.sample?raw';
9+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
910

1011
<Meta of={CardControlStories} />
1112

@@ -80,9 +81,7 @@ import SampleCardControlMethods from './web-component/card-control-methods.sampl
8081
<Canvas of={CardControlStories.Default} sourceState="shown" />
8182
<Controls of={CardControlStories.Default} />
8283

83-
## Installation
84-
85-
The `<post-card-control>` element is part of the `@swisspost/design-system-components` package. For more information, read the <a href="/?path=/docs/edfb619b-fda1-4570-bf25-20830303d483--docs">getting started with components guide</a>.
84+
<ComponentsPackageInstall component="<post-card-control>" />
8685

8786
## Examples
8887

packages/documentation/src/stories/components/collapsible/collapsible.docs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Canvas, Controls, Meta, Source } from '@storybook/addon-docs/blocks';
22
import * as CollapsibleStories from './collapsible.stories';
33
import SampleCustomTrigger from './collapsible-custom-trigger.sample?raw';
4+
import ComponentsPackageInstall from '@/shared/components-package-install.mdx';
45

56
<Meta of={CollapsibleStories} />
67

@@ -14,6 +15,8 @@ Collapsing an element will animate the height from its current value to 0.
1415
<Canvas sourceState="shown" of={CollapsibleStories.Default} />
1516
<Controls of={CollapsibleStories.Default} />
1617

18+
<ComponentsPackageInstall component="<post-collapsible>" />
19+
1720
## Examples
1821

1922
The following examples show different use cases for the `<post-collapsible>` component.

0 commit comments

Comments
 (0)