-
Notifications
You must be signed in to change notification settings - Fork 69
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
Components structure #2080
Comments
Folders are good. |
@flacial Is this something I can help out with? It would be nice to have everything in folders. Also, I'm not sure I understand the problem with moving the I played around with the glob on the Learn Storybook repo: Example 1
Example 2
For c0d3 appIf we changed the glob to This will also allow us to keep the pages and MDX stories wherever we want. I can try this it out later to check. |
Problem
Our current components structure looks like the following:
components/
components/
styles/
stories/
They're scattered into 3 directories. And within the
components/
folder, there are two files, the component code, and the test. Having such a structure makes it cluttered and hard to work with. As our codebase isn't huge yet, it's better to fix this issue now than later.Solution
Each component will have its folder. This folder will contain the component and its: test, story, and styles
The component entry point will be called
index.tsx
so it can be easily imported (or it could be used to export to[componentName].tsx
, so we don't end up with all the file names beingindex.tsx
). The folder will also contain the CSS, test file, and story.index.tsx
will contain the following, so we can doimport Component from '../components/ComponentFolder'
instead of./components/ComponentFolder/ComponentFolder
export { default } from './CopyButton.tsx'
The text was updated successfully, but these errors were encountered: