Skip to content

Group the files for each component in the same directory? #189

@severo

Description

@severo

Currently, the code related to a single component is spread in three different places, eg:

src/components/Component.tsx
src/styles/Component.module.css
test/Component.test.tsx

The proposal is to create a subdirectory in components that contains all the files:

src/components/Component/Component.tsx
src/components/Component/Component.module.css
src/components/Component/Component.test.tsx

More details, from #188:

I think we could reorganize the files a bit, like I did in hightable, loosely following https://www.joshwcomeau.com/react/file-structure/:

  • move the files from components/viewers to components/ (no semantic hierarchy)
  • move every component file to its own subdirectory (App.tsx -> App/App.tsx)
  • move the styles (CSS modules) to these subdirectories (styles/Json.module.css => components/Json/Json.module.css)
  • (maybe) move the tests to these subdirectories (test/Layout.test.tsx => components/Layout/Layout.test.tsx) - it requires tweaking the build process to ignore these files.

It would help find the files quickly, and it would group the styles and components together

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions