github-readme-quotes icon indicating copy to clipboard operation
github-readme-quotes copied to clipboard

Remove Theme.js Code Duplication [Refactoring]

Open shravan20 opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Constant Values stored as JSON values are duplicated across the frontend and backend version.

Describe the solution you'd like Remove the duplicated version inside the /frontend/src/util/themes/index.js file and use the existing backend-version file

shravan20 avatar Apr 30 '21 04:04 shravan20

Hi, I removed /frontend/src/util/themes/index.js and tried to import backend version, but encountered this error.

./src/components/organisms/TemplateCard/index.js
Module not found: You attempted to import ../../../../../src/themes/themes which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

This is because Create React App does not allow frontend code to import outside /src directory. Links below have some workaround. (the simplest one should be to delete backend const file and backend code imports frontend const file instead). Do you have any solution in your mind?

Reference https://stackoverflow.com/questions/44114436/the-create-react-app-imports-restriction-outside-of-src-directory https://stackoverflow.com/questions/59571680/react-backend-project-structure-when-sharing-code

toshihidetagami avatar Jul 10 '21 09:07 toshihidetagami

Hi, we can import the themes into theme.js and export it again from the same file.

shravan20 avatar Jul 10 '21 10:07 shravan20

looking for my first contribution in open source, can anyone guide me where to start with the issue. i would love to work on it

sanchit36 avatar Jan 14 '22 17:01 sanchit36