Skip to content
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

chore(documentation): add palette scss file import documentation #4127

Merged
merged 11 commits into from
Dec 17, 2024
Merged
5 changes: 5 additions & 0 deletions .changeset/four-beers-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Added scss file import documentation to palette.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Canvas, Controls, Meta } from '@storybook/blocks';
import * as paletteStories from './palettes.stories';
import StylesPackageImport from '@/shared/styles-package-import.mdx';

<Meta of={paletteStories} />

Expand All @@ -25,3 +26,5 @@ You can apply this text color to any element by using the `.palette-text` class.
<div className="hide-col-default">
<Controls of={paletteStories.Default} />
</div>

<StylesPackageImport components={['post-palettes']} />
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good if the import could adapt to the selected theme. It is stored in the local storage under swisspost-documentation-theme, if not defined the default is "Post".

Copy link
Contributor Author

@leagrdv leagrdv Dec 10, 2024

Choose a reason for hiding this comment

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

If I use the value from the local storage, it doesn't update when I change the theme, so I had to update the styles package import from the styles switcher directly: https://github.com/swisspost/design-system/pull/4085/files#diff-7afcbc69ddf51598841204e61dceede5164073437393967b7e3b4c345515983b
It detects if there is a theme or a channel in the path of the scss and replaces it if needed to the correct theme.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it also update post-palettes for cargo-palettes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if you check here and switch the theme, you'll see it changes it dynamically to cargo-palettes: https://preview-4127--swisspost-design-system-next.netlify.app/?path=/docs/43481535-5b39-40b5-a273-478b07dc3b31--docs

Loading