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

[Storybook] implement uuid generation for stories #208

Open
seedy opened this issue Nov 25, 2021 · 1 comment
Open

[Storybook] implement uuid generation for stories #208

seedy opened this issue Nov 25, 2021 · 1 comment
Labels
enhancement New feature or request kind/proposal

Comments

@seedy
Copy link
Contributor

seedy commented Nov 25, 2021

Description

Some stories require one or more unique ids to bind inner components together.

For example:

  • Label stories require to bind htmlFor from a Label on an input id prop
  • TextField stories require a unique id prop
  • Input stories require to bind htmlFor from a Label on Input id prop

Radix-UI already implemented an IdProvider for its primitives, but it seems not to expose its api.

Requirements

We need to be able duplicate a story (with .bind({})) without duplicating these unique ids.

As we may need multiple unique ids inside of a single story, it would be helpful to be able to configure how many ids we want, and receive them as an array.

Ex:

const [id1, id2, id3, id4] = makeUniqueIds(4);

Dependencies

uuid and uuid-browser are already dependencies of @storybook/addon-actions. We could reuse the library if we have no better option.

@seedy
Copy link
Contributor Author

seedy commented Nov 25, 2021

Could be a simple solution: reactwg/react-18#111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kind/proposal
Projects
None yet
Development

No branches or pull requests

1 participant