@@ -12,29 +12,33 @@ type NonScrollableContentProps = {
1212 footer : ReactNode
1313 children : ReactNode
1414 totalPriceInfo ?: ReactNode
15+ totalPriceInfoPlacement ?: 'left' | 'right'
1516 totalPriceDescription ?: ReactNode
1617 additionalInfo ?: string
1718 hideDetails : boolean
1819 unit : TimeUnit
20+ hideBeforePrice ?: boolean
1921}
2022
2123export const NonScrollableContent = ( {
2224 totalPrice,
2325 footer,
2426 children,
2527 totalPriceInfo,
28+ totalPriceInfoPlacement,
2629 hideDetails,
2730 unit,
2831 totalPriceDescription,
2932 additionalInfo,
33+ hideBeforePrice,
3034} : NonScrollableContentProps ) => {
3135 const { locales } = useContext ( OrderSummaryContext )
3236
3337 return (
3438 < Stack className = { orderSummaryNonScrollableContainer } gap = { 3 } >
3539 { children }
3640 < Stack alignItems = "center" direction = "row" justifyContent = "space-between" >
37- { totalPriceInfo ? (
41+ { totalPriceInfo && totalPriceInfoPlacement === 'left' ? (
3842 < Stack >
3943 < Stack alignItems = "center" direction = "row" gap = { 1 } >
4044 < Text
@@ -63,28 +67,9 @@ export const NonScrollableContent = ({
6367 { totalPriceDescription }
6468 </ Stack >
6569 ) }
66- { totalPrice . totalPrice === totalPrice . totalPriceWithDiscount ? (
67- < Text
68- as = "span"
69- data-testid = "total-price"
70- prominence = "strong"
71- sentiment = "neutral"
72- variant = "headingSmallStrong"
73- >
74- < DisplayPrice beforeOrAfter = "after" price = { totalPrice } />
75- { hideDetails ? `/${ unit } ` : null }
76- </ Text >
77- ) : (
78- < Stack alignItems = "center" direction = "row" gap = { 1 } >
79- < Text
80- as = "span"
81- prominence = "weak"
82- sentiment = "neutral"
83- strikeThrough
84- variant = "bodySmallStrong"
85- >
86- < DisplayPrice beforeOrAfter = "before" price = { totalPrice } />
87- </ Text >
70+ < Stack alignItems = "end" direction = "column" >
71+ { totalPrice . totalPrice === totalPrice . totalPriceWithDiscount ||
72+ hideBeforePrice ? (
8873 < Text
8974 as = "span"
9075 data-testid = "total-price"
@@ -95,8 +80,33 @@ export const NonScrollableContent = ({
9580 < DisplayPrice beforeOrAfter = "after" price = { totalPrice } />
9681 { hideDetails ? `/${ unit } ` : null }
9782 </ Text >
98- </ Stack >
99- ) }
83+ ) : (
84+ < Stack alignItems = "center" direction = "row" gap = { 1 } >
85+ < Text
86+ as = "span"
87+ prominence = "weak"
88+ sentiment = "neutral"
89+ strikeThrough
90+ variant = "bodySmallStrong"
91+ >
92+ < DisplayPrice beforeOrAfter = "before" price = { totalPrice } />
93+ </ Text >
94+ < Text
95+ as = "span"
96+ data-testid = "total-price"
97+ prominence = "strong"
98+ sentiment = "neutral"
99+ variant = "headingSmallStrong"
100+ >
101+ < DisplayPrice beforeOrAfter = "after" price = { totalPrice } />
102+ { hideDetails ? `/${ unit } ` : null }
103+ </ Text >
104+ </ Stack >
105+ ) }
106+ { totalPriceInfo && totalPriceInfoPlacement === 'right'
107+ ? totalPriceInfo
108+ : null }
109+ </ Stack >
100110 </ Stack >
101111 { footer }
102112 </ Stack >
0 commit comments