swisspost / design-system

The Swiss Post Design System pattern library for a consistent and accessible user experience across the web platform.
https://design-system.post.ch
Apache License 2.0
106 stars 13 forks source link

feat(documentation): Set id/permalink for stories #2603

Closed imagoiq closed 3 months ago

imagoiq commented 3 months ago

Set an id for each story as in https://storybook.js.org/docs/configure/sidebar-and-urls#permalink-to-stories. This allows to separate the URL generation from the display name. The URL is generated with the id and the name of the story with the title. You can change the title without changing the id so we can keep a kind of permalink.

Most of id are duplicated from title, except for foundations.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: 5711c31e8955a5fafe08c1ab9b8105c964f94f7f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

swisspost-bot commented 3 months ago

Preview environment ready: https://preview-2603--swisspost-design-system-next.netlify.app

imagoiq commented 3 months ago

Those code smells have nothing do it with this PR, fixed in https://github.com/swisspost/design-system/pull/2605

imagoiq commented 3 months ago

This is great! 👍

Can you just update the links to the foundation docs using the new id's?

Good catch!

Also, I'm not sure that using the titles as identifiers is the best solution because there will be discrepancies as soon as we update a component name... I would probably go for a unique id, maybe with an enum somewhere. What do you think?

I think this is a timeless question between slug vs id/uuid. It can be one or another, or mixed. I'm not really fond of only uuid as it's not user-friendly (and a bit prone to security issue). Using a mix doesn't make it more permanent except if we say that the slug is only here for human (e.g. /bzasdh/accessibility) and is ignored in the redirect process, but this is not how Storybook works, and it doesn't allow that. I think we just should care of any changes and redirect path using a middleware. So it's debatable, perhaps we should have survey in the roundtable meeting?

alizedebray commented 3 months ago

So it's debatable, perhaps we should have survey in the roundtable meeting?

Sure, let's talk about that with the team

imagoiq commented 3 months ago

It was decided on the roundtable to used exclusively uuid.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud