Skip to content

chore: reorganize storybook #10144

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

Merged
merged 2 commits into from
Oct 9, 2023
Merged

chore: reorganize storybook #10144

merged 2 commits into from
Oct 9, 2023

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Oct 9, 2023

Screenshot 2023-10-09 at 11 52 39 AM

mostly just reorganizing pages stories. hoping it'll be a lot easier to find stuff now!

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

I don't have an opinion about how we organize things on storybook but I found this an improvement so I'm approving it 👍

@BrunoQuaresma
Copy link
Collaborator

PS: Just check and approve the changes on Chromatic 😆

@aslilac aslilac merged commit 1cdc62b into main Oct 9, 2023
@aslilac aslilac deleted the storybook-gardening branch October 9, 2023 19:26
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2023
Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

This looks really nice!

export const Example: Story = {};
const Example: Story = {};

export { Example as UserDropdown };
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, could you explain what's going on with this line? I feel like there's something Storybook-specific that I'm missing.

From what I can tell, the code is:

  1. Exporting an anonymous/unnamed object
  2. Passing in Example via object shorthand
  3. It's also using the as keyword, but I'm not completely sure if this is the TS type-assertion version, or the JS module exports version

My guess is that this is just a named export that exports Example with the type of UserDropdown?

Copy link
Member Author

Choose a reason for hiding this comment

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

if you export a story that has the same name as the last bit of the "path", then storybook will flatten it.

...but we can't export const UserDropdown because this file already imports a UserDropdown component, so that name is taken, and we can't redeclare it. so we have to define it with a different name, and then use this syntax to say "export that variable, but with this as the name instead"

Copy link
Member Author

Choose a reason for hiding this comment

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

so there's no object literal here. it's analogous to import { SomeThing as SomeThingElse } from "...";.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, cool. That makes sense. Thanks for explaining!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants