MartinP460 / react-denmark-map

Customizable plug-and-play map of Denmark for visual presentation🗺️
https://react-denmark-map.vercel.app/
MIT License
21 stars 4 forks source link

Change folder structure in `core` #56

Open MartinP460 opened 7 months ago

MartinP460 commented 7 months ago

Description

This is part 1 of changing the folder structure and in this issue changes should be made in the core project. Currently, there is no formal convention on folder structure and we would like to change that by adopting a feature-based structure.

Proposed solution

In the components directory in the core project, change the folder structure to a feature based structure. Remember to change the internal documentation in packages/core/README.md.

Additional context

A feature-based folder structure is a folder structure where components, types, utility functions, etc. related to a feature are encapsulated in their own folder. Keep in mind that we define the map, tooltip and zoompane components and all the areas as "features" in this case. Below is a shortened diagram showing how the file and folder structure should roughly look after the change.

components/
├── areas/
│   ├── municipalities/
│   │   ├── municipalities.data.ts
│   │   ├── index.tsx
│   │   └── ...
│   ├── regions
│   └── ...
├── map/
│   ├── map.types.ts
│   ├── map.test.tsx
│   ├── index.tsx
│   └── ...
├── tooltip
└── zoompane

Inside of each folder, the index.tsx file should be the component and the other files should named according to what they are, e.g. [name].types.ts or [name].test.ts for types and tests respectively.