Overriding components without interfering with other sections (SimpleResponsiveBannerComponent)

237 views Asked by At

I want to change what is in Section1 and from the spartacus videos what I should do is overriding the component used in that section. However that component is the SimpleResponsiveBannerComponent and it exists at least in Section1, Section2A and Section2B. So if I override that component I'm also "deleting" the content in others sections. How can I only change (by code) what is in Section1 without interfering with others sections?

1

There are 1 answers

0
Artem Zur On

Since Spartacus is fully CMS-driven and everything in Slots depends on CMS data, following this methodology - best way, to prevent side effects during data manipulation via CMS, that's why, I think that you have only one "right" way to figure it out.

If you change component's UI/UX behaviour - it means that you start provide new component that will be different from what you have inside another Slots (Section1, Section2A and Section2B).

Create another CMS component with custom typeCode to implement something different from SimpleResponsiveBannerComponent. Add custom component where you need and leave SimpleResponsiveBannerComponent inside Section1, Section2A and Section2B.

I believe, that other possible way to implement it on frontend code-base side (if they really exist) - wrong way and can born additional problems during manipulating with data via SmartEdit.