noveogroup-amorgunov / nukeapp

An open source frontend application built using the React ⚛️ and Feature-Sliced Design 🍰.
https://nukeapp.netlify.app/
MIT License
320 stars 33 forks source link

Add custom sublayer for base widgets #21

Closed noveogroup-amorgunov closed 6 months ago

noveogroup-amorgunov commented 6 months ago

Motivation

Usually we don't have enough layers to composite UI. For example, we have ProductList widget which uses different entities and features. At the same time, we have N widgets like {Any}ProductList (for example, PopularProductList) that use ProductList. Of course, we can make dumb ProductList and place it on entities/product level and pass all data as props, but every of the N widgets will duplicate each other's logic (hello prop drilling). A lot of duplication of each other.

So, there are several options:

Initially, this project used the second approach 2️⃣ (we use this approach on the working project as well), when cross-imports between widgets were allowed. But this option violates the low coupling principle, and this can become a problem in large projects.

This pull request introduces a fourth option: 4️⃣ a new sublayer for base widgets that can be imported by other widgets. If a widget's name starts with widget/Base*, then it is a base widget and can be imported by other widgets.

Changes (roadmap)

netlify[bot] commented 6 months ago

Deploy Preview for nukeapp ready!

Name Link
Latest commit c3661bf9fc558642fe5321936a79283201e544da
Latest deploy log https://app.netlify.com/sites/nukeapp/deploys/65fac250a1632600080713c9
Deploy Preview https://deploy-preview-21--nukeapp.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 6 months ago

Deploy Preview for nukeapp-story ready!

Name Link
Latest commit c3661bf9fc558642fe5321936a79283201e544da
Latest deploy log https://app.netlify.com/sites/nukeapp-story/deploys/65fac2505cb14100085ef5e4
Deploy Preview https://deploy-preview-21--nukeapp-story.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.