-
Notifications
You must be signed in to change notification settings - Fork 886
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
chore: reorganize storybook #10144
Conversation
There was a problem hiding this 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 👍
PS: Just check and approve the changes on Chromatic 😆 |
There was a problem hiding this 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 }; |
There was a problem hiding this comment.
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:
- Exporting an anonymous/unnamed object
- Passing in
Example
via object shorthand - 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
?
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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 "...";
.
There was a problem hiding this comment.
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!
mostly just reorganizing pages stories. hoping it'll be a lot easier to find stuff now!