Open kohchihao opened 3 years ago
Please share your concerns and suggestions if any
I agree that the above is a more maintainable structure, but refactoring this might take quite an effort so I suggest that we do this incrementally, perhaps on a page by page basis
@jamessspanggg Agreed. This should be done incrementally. After this is approved by everyone, I will make a todo list within this issue to track what needs to changed.
Folder structure looks good with clear purpose for each location. Just a few questions:
src/components
is for reusuable components only right?src/pages/{pageName}/utils
: Any examples of what utils we have?@jinyingtan
Regarding
Cards
, Buttons
, Footer
, etc... utils/algolia/filteringRules
--> if we can split them into respective pages, it much easier for the developer to find.After speaking to everyone. We have decided to go ahead with this major refactoring. I will put a Todo list inside this issue to keep track of the changes that we need to make over the subsequent weeks.
Let's refactor pages first and leave the individual components alone.
By doing this refactor, there might be duplicated code. It is fine because it helps with the readability of the codebase overall. But we shouldn't be afraid of having some duplicated code.
Issue
As GFG repo continues to grow larger, the current folder structure doesn't seem be as clear and direct to a developer.
As a result, differentiating from a
dummy
component from apage
component is difficult.Suggestion
src/components
:dummy
componentssrc/pages
:page
componentssrc/pages/{pageName}/index.js
src/pages/{pageName}/components
page
components should live within hereindex.js
that exports all the components within, this is done so that importing components can be in a single linesrc/pages/components/RegisterDonor/index.js
can havesrc/pages/components/RegisterDonor/components/RegisterCard/index.js
src/pages/{pageName}/utils
src/pages/{pageName}/constants
src/utils
src/constants
Additionally, try to group the import statements based on their groups if possible, i.e.
Template to copy
Benefits
Downsides