diff --git a/packages/documentation/.storybook/preview.ts b/packages/documentation/.storybook/preview.ts
index 5b5f7ab405..cbe5eebdea 100644
--- a/packages/documentation/.storybook/preview.ts
+++ b/packages/documentation/.storybook/preview.ts
@@ -13,6 +13,8 @@ import scss from 'react-syntax-highlighter/dist/esm/languages/prism/scss';
SyntaxHighlighter.registerLanguage('scss', scss);
+export const SourceDarkMode = true;
+
const preview: Preview = {
parameters: {
options: {
@@ -56,6 +58,7 @@ const preview: Preview = {
},
source: {
excludeDecorators: true,
+ dark: SourceDarkMode,
transform: (snippet: string) => format(snippet, prettierOptions),
},
components: resetComponents,
diff --git a/packages/documentation/src/shared/styles-package-import-individual.sample.ts b/packages/documentation/src/shared/styles-package-import-individual.sample.ts
new file mode 100644
index 0000000000..74e983a968
--- /dev/null
+++ b/packages/documentation/src/shared/styles-package-import-individual.sample.ts
@@ -0,0 +1,25 @@
+interface Props {
+ components: string[];
+ required?: { icons: boolean; floatingLabel: boolean; formFeedback: boolean };
+}
+
+const requiredLabels: { [key: string]: string } = {
+ 'icons': 'required if you use icons',
+ 'floating-label': 'required if you use floating-labels',
+ 'form-feedback': 'required if you use validation feedbacks',
+};
+
+export function getStylesPackageImportIndividual(props: Props) {
+ const basics = `@use '@swisspost/design-system-styles/basics.scss';`;
+ const generateComponentLine = (name: string) =>
+ `@use '@swisspost/design-system-styles/components/${name}.scss';`;
+ const components = props.components.map(generateComponentLine).join('\n');
+
+ const required = Object.keys(props?.required || {}).reduce(
+ (acc: string, curr: string) =>
+ `${acc}\n// ${requiredLabels[curr]}\n${generateComponentLine(curr)}`,
+ '',
+ );
+
+ return `${basics}\n${components}\n${required}`;
+}
diff --git a/packages/documentation/src/shared/styles-package-import.mdx b/packages/documentation/src/shared/styles-package-import.mdx
new file mode 100644
index 0000000000..2b03422dc4
--- /dev/null
+++ b/packages/documentation/src/shared/styles-package-import.mdx
@@ -0,0 +1,20 @@
+import { Source } from '@storybook/blocks';
+import { getStylesPackageImportIndividual } from './styles-package-import-individual.sample';
+
+## SCSS Imports
+
+To import all styles from the design-system-styles package:
+
+
+
+To import only the styles required for this component:
+
+
diff --git a/packages/documentation/src/stories/components/alert/alert.docs.mdx b/packages/documentation/src/stories/components/alert/alert.docs.mdx
index e037c041aa..571d0a110a 100644
--- a/packages/documentation/src/stories/components/alert/alert.docs.mdx
+++ b/packages/documentation/src/stories/components/alert/alert.docs.mdx
@@ -1,5 +1,6 @@
import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as AlertStories from './alert.stories';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
@@ -16,20 +17,7 @@ By default, alerts are rendered with a contextually appropriate icon.
-## SCSS Imports
-
-To import all styles from the design-system-styles package:
-
-```scss
-@use '@swisspost/design-system-styles/index.scss';
-```
-
-To import only the styles required for this component:
-
-```scss
-@use '@swisspost/design-system-styles/basics.scss';
-@use '@swisspost/design-system-styles/components/alert.scss';
-```
+
## Specific examples of application
diff --git a/packages/documentation/src/stories/components/badge/badge.docs.mdx b/packages/documentation/src/stories/components/badge/badge.docs.mdx
index 92fb95f735..0dd744831d 100644
--- a/packages/documentation/src/stories/components/badge/badge.docs.mdx
+++ b/packages/documentation/src/stories/components/badge/badge.docs.mdx
@@ -1,5 +1,6 @@
-import { Meta, Canvas, Controls } from '@storybook/blocks';
+import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as badgeStories from './badge.stories';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
@@ -14,20 +15,7 @@ import * as badgeStories from './badge.stories';
-## SCSS Imports
-
-To import all styles from the design-system-styles package:
-
-```scss
-@use '@swisspost/design-system-styles/index.scss';
-```
-
-To import only the styles required for this component:
-
-```scss
-@use '@swisspost/design-system-styles/basics.scss';
-@use '@swisspost/design-system-styles/components/badge.scss';
-```
+
## Examples
diff --git a/packages/documentation/src/stories/components/blockquote/blockquote.docs.mdx b/packages/documentation/src/stories/components/blockquote/blockquote.docs.mdx
index 7a32ef7d88..bb51e8707e 100644
--- a/packages/documentation/src/stories/components/blockquote/blockquote.docs.mdx
+++ b/packages/documentation/src/stories/components/blockquote/blockquote.docs.mdx
@@ -1,13 +1,15 @@
-import { Meta, Canvas, Controls } from '@storybook/blocks';
+import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as BlockquoteStories from './blockquote.stories.ts';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
# Blockquote
- For quoting blocks of content from another source within your document. Wrap `
` around any HTML as the quote.
+ For quoting blocks of content from another source within your document. Wrap `
+
` around any HTML as the quote.
@@ -16,20 +18,7 @@ import * as BlockquoteStories from './blockquote.stories.ts';
-## SCSS Imports
-
-To import all styles from the design-system-styles package:
-
-```scss
-@use '@swisspost/design-system-styles/index.scss';
-```
-
-To import only the styles required for this component:
-
-```scss
-@use '@swisspost/design-system-styles/basics.scss';
-@use '@swisspost/design-system-styles/components/blockquote.scss';
-```
+
## Concrete Examples of Application
@@ -37,6 +26,7 @@ The following examples show the different characteristics of the component. Thes
### Nested
-To add simple quote characters around any nested text within your blockquote, you can wrap it with a <q> tag.
+To add simple quote characters around any nested text within your blockquote, you can wrap it with a
+<q> tag.
diff --git a/packages/documentation/src/stories/components/button-group/button-group.docs.mdx b/packages/documentation/src/stories/components/button-group/button-group.docs.mdx
index fce158e002..9387e0206f 100644
--- a/packages/documentation/src/stories/components/button-group/button-group.docs.mdx
+++ b/packages/documentation/src/stories/components/button-group/button-group.docs.mdx
@@ -1,5 +1,6 @@
import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as ButtonGroupStories from './button-group.stories';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
@@ -14,20 +15,7 @@ import * as ButtonGroupStories from './button-group.stories';
-## SCSS Imports
-
-To import all styles from the design-system-styles package:
-
-```scss
-@use '@swisspost/design-system-styles/index.scss';
-```
-
-To import only the styles required for this component:
-
-```scss
-@use '@swisspost/design-system-styles/basics.scss';
-@use '@swisspost/design-system-styles/components/badge.scss';
-```
+
## Concrete Examples of Application
diff --git a/packages/documentation/src/stories/components/button/button.docs.mdx b/packages/documentation/src/stories/components/button/button.docs.mdx
index 613d91d1ee..e146b17c05 100644
--- a/packages/documentation/src/stories/components/button/button.docs.mdx
+++ b/packages/documentation/src/stories/components/button/button.docs.mdx
@@ -1,6 +1,7 @@
-import { Meta, Canvas, Controls } from '@storybook/blocks';
+import { Canvas, Controls, Meta } from '@storybook/blocks';
import LinkTo from '@storybook/addon-links/react';
import * as ButtonStories from './button.stories';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
@@ -16,23 +17,7 @@ import * as ButtonStories from './button.stories';
-## SCSS Imports
-
-To import all styles from the design-system-styles package:
-
-```scss
-@use '@swisspost/design-system-styles/index.scss';
-```
-
-To import only the styles required for this component:
-
-```scss
-@use '@swisspost/design-system-styles/basics.scss';
-@use '@swisspost/design-system-styles/components/button.scss';
-
-// required if you use icons
-@use '@swisspost/design-system-styles/components/icons.scss';
-```
+
## Concrete Examples of Application
@@ -40,7 +25,9 @@ The following examples show the different characteristics of the component. Thes
### Inverted
-Inverted buttons don't need special classes anymore, just use any of the background classes to set the background and you're done for the day.
+Inverted buttons don't need special classes anymore, just use any of the
+background
+ classes to set the background and you're done for the day.
diff --git a/packages/documentation/src/stories/components/card/card.docs.mdx b/packages/documentation/src/stories/components/card/card.docs.mdx
index 3a4283b0c3..67ad1b5c3a 100644
--- a/packages/documentation/src/stories/components/card/card.docs.mdx
+++ b/packages/documentation/src/stories/components/card/card.docs.mdx
@@ -1,6 +1,7 @@
-import { Meta, Canvas, Controls } from '@storybook/blocks';
-import LinkTo from '@storybook/addon-links/react';
+import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as CardStories from './card.stories';
+import StylesPackageImport from '../../../shared/styles-package-import.mdx';
+import LinkTo from '@storybook/addon-links/react';
@@ -14,27 +15,15 @@ Built with flexbox, they offer easy alignment and mix well with other components
They have no fixed width to start, so they’ll naturally fill the full width of its parent element.
This is easily customizable using the grid for example,
-for more details read our layout docs.
+for more details read our
+layout docs.
-