@@ -186,7 +186,7 @@ The `DecoratedPrice` requires a new prop `customText`, exclusively for `store-b`
186
186
187
187
1. **Duplicate** the component for ` store - b ` .
188
188
2. **Modify the props interface** to include the new prop.
189
- 3. **Implement fallback behaviors** it's best to make new props as optional to ensure existing components using the old interface remain functional
189
+ 3. **Implement fallback behaviors** make new props as optional to ensure existing components using the old interface remain functional
190
190
4. **Modify components usage** update props passed to the changed component in other parts of your store that are using it
191
191
192
192
#### In Next.js
@@ -443,7 +443,7 @@ This approach is particularly useful when you've identified that certain feature
443
443
#### Example Workflow
444
444
445
445
1. **Remove** the specialized props from the parent store component
446
- 2. **Add** the props only to the store specific component
446
+ 2. **Add** the props only to the store specific component. Use optional props to ensure compatibility with other stores
447
447
3. **Update** implementations of the changed component in specific store
448
448
449
449
#### In Next.js
@@ -523,7 +523,7 @@ export interface ClassNameVariants {
523
523
// Added prop to store-a
524
524
export interface DecoratedPriceProps {
525
525
className?: string ;
526
- classNameVariants : ClassNameVariants ; // [!code ++]
526
+ classNameVariants ? : ClassNameVariants ; // [!code ++]
527
527
price : SfProduct [' price' ];
528
528
}
529
529
@@ -538,7 +538,7 @@ export default function DecoratedPrice({ className, classNameVariants, price, ..
538
538
price && (
539
539
<div className = { classNames (' flex items-baseline gap-x-2' , className )} { ... rest } >
540
540
<span
541
- className = { classNames (' font-semibold' , classNameVariants .regular , { // [!code ++]
541
+ className = { classNames (' font-semibold' , classNameVariants ? .regular , { // [!code ++]
542
542
className = {classNames(' font-semibold' , { // [!code --]
543
543
' text-neutral-900' : !special ,
544
544
' text-secondary-700' : special ,
@@ -550,7 +550,7 @@ export default function DecoratedPrice({ className, classNameVariants, price, ..
550
550
{special && (
551
551
<span
552
552
className = { classNames (' font-normal text-neutral-500 line-through' )} // [!code --]
553
- className = { classNames (' font-normal text-neutral-500 line-through' , classNameVariants .special )} // [!code ++]
553
+ className = { classNames (' font-normal text-neutral-500 line-through' , classNameVariants ? .special )} // [!code ++]
554
554
data-testid = " regular-price"
555
555
>
556
556
{ special }
@@ -617,7 +617,7 @@ And add it to specific stores that need it:
617
617
data-testid = " special-price"
618
618
:class="[
619
619
' font-semibold' ,
620
- classNameVariants.regular, // [!code ++]
620
+ classNameVariants? .regular, // [!code ++]
621
621
{
622
622
' text-neutral-900' : ! special ,
623
623
' text-secondary-700' : special ,
@@ -630,7 +630,7 @@ And add it to specific stores that need it:
630
630
v-if = " special"
631
631
data-testid = " regular-price"
632
632
:class="['font-normal text-neutral-500 line-through']" // [!code --]
633
- :class="['font-normal text-neutral-500 line-through', classNameVariants.special]" // [!code ++]
633
+ :class="['font-normal text-neutral-500 line-through', classNameVariants? .special]" // [!code ++]
634
634
>
635
635
{ { special }}
636
636
</span >
@@ -641,7 +641,7 @@ And add it to specific stores that need it:
641
641
// Prop is added to the store-a component
642
642
defineProps<{
643
643
className ?: string ;
644
- classNameVariants : ClassNameVariants ; // [!code ++]
644
+ classNameVariants ? : ClassNameVariants ; // [!code ++]
645
645
regular : string ;
646
646
special ?: string ;
647
647
} >();
@@ -679,4 +679,4 @@ While introducing breaking changes, follow these strategies to ensure stability:
679
679
680
680
## Conclusion
681
681
682
- Customizing individual components in a **multibrand setup** can effectively address brand-specific requirements while maintaining maintainable code. Follow these steps to confidently adjust component markups while avoiding breaking changes whenever possible.
682
+ Customizing individual components in a **multibrand setup** can effectively address brand-specific requirements while keeping the code maintainable . Follow these steps to confidently adjust component markups while avoiding breaking changes whenever possible.
0 commit comments