File tree Expand file tree Collapse file tree 6 files changed +29
-32
lines changed
src/components/marketing/banners Expand file tree Collapse file tree 6 files changed +29
-32
lines changed Original file line number Diff line number Diff line change 4343 "@guardian/shimport" : " 1.0.2" ,
4444 "@guardian/source" : " 11.3.0" ,
4545 "@guardian/source-development-kitchen" : " 18.1.1" ,
46- "@guardian/support-dotcom-components" : " 8.2.0 " ,
46+ "@guardian/support-dotcom-components" : " 8.3.1 " ,
4747 "@guardian/tsconfig" : " 0.2.0" ,
4848 "@playwright/test" : " 1.56.1" ,
4949 "@sentry/browser" : " 10.24.0" ,
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ const withBannerData =
9494 bannerChannel,
9595 abandonedBasket,
9696 promoCodes,
97+ isCollapsible,
9798 } = bannerProps ;
9899
99100 const [ hasBeenSeen , setNode ] = useIsInView ( {
@@ -347,6 +348,7 @@ const withBannerData =
347348 submitComponentEvent,
348349 design,
349350 promoCodes,
351+ isCollapsible,
350352 } ;
351353
352354 return (
Original file line number Diff line number Diff line change @@ -81,4 +81,5 @@ export interface BannerRenderProps {
8181 submitComponentEvent ?: ( componentEvent : ComponentEvent ) => void ;
8282 design ?: ConfigurableDesign ;
8383 promoCodes ?: string [ ] ;
84+ isCollapsible ?: boolean ;
8485}
Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
145145 design,
146146 countryCode,
147147 promoCodes,
148+ isCollapsible,
148149} : BannerRenderProps ) : JSX . Element => {
149150 const isTabletOrAbove = useMatchMedia ( removeMediaRulePrefix ( from . tablet ) ) ;
150151
@@ -163,15 +164,16 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
163164 ChoiceCard | undefined
164165 > ( defaultChoiceCard ) ;
165166
166- const isCollapsableBanner =
167- tracking . abTestVariant . includes ( 'COLLAPSABLE_V1' ) ||
168- tracking . abTestVariant . includes ( 'COLLAPSABLE_V2_MAYBE_LATER' ) ;
167+ const isCollapsableBanner : boolean =
168+ isCollapsible ??
169+ ( tracking . abTestVariant . includes ( 'COLLAPSABLE_V1' ) ||
170+ tracking . abTestVariant . includes ( 'COLLAPSABLE_V2_MAYBE_LATER' ) ) ;
169171
170- const contextClassName = tracking . abTestVariant . includes (
171- 'COLLAPSABLE_V2_MAYBE_LATER' ,
172- )
173- ? 'maybe-later'
174- : '' ;
172+ const contextClassName =
173+ isCollapsible ||
174+ tracking . abTestVariant . includes ( 'COLLAPSABLE_V2_MAYBE_LATER' )
175+ ? 'maybe-later'
176+ : '' ;
175177
176178 const [ isCollapsed , setIsCollapsed ] = useState < boolean > ( false ) ;
177179
Original file line number Diff line number Diff line change @@ -323,16 +323,14 @@ export const CollapsableWithThreeTierChoiceCards: Story = {
323323 buttonColour : stringToHexColour ( 'F1F8FC' ) ,
324324 } ,
325325 } ,
326- tracking : {
327- ...tracking ,
328- abTestVariant : 'COLLAPSABLE_V1' ,
329- } ,
326+ tracking,
330327 choiceCardAmounts : regularChoiceCardAmounts ,
331328 choiceCardsSettings,
332329 tickerSettings,
333330 separateArticleCountSettings : {
334331 type : 'above' ,
335332 } ,
333+ isCollapsible : true ,
336334 } ,
337335} ;
338336
@@ -344,10 +342,8 @@ export const CollapsableWithMainImage: Story = {
344342 ...design ,
345343 visual : regularImage ,
346344 } ,
347- tracking : {
348- ...tracking ,
349- abTestVariant : 'COLLAPSABLE_V1' ,
350- } ,
345+ tracking,
346+ isCollapsible : true ,
351347 } ,
352348} ;
353349
@@ -359,10 +355,8 @@ export const CollapsableMaybeLaterVariant: Story = {
359355 ...design ,
360356 visual : regularImage ,
361357 } ,
362- tracking : {
363- ...tracking ,
364- abTestVariant : 'COLLAPSABLE_V2_MAYBE_LATER' ,
365- } ,
358+ tracking,
359+ isCollapsible : true ,
366360 } ,
367361} ;
368362
@@ -377,15 +371,13 @@ export const CollapsableWithThreeTierChoiceCardsMaybeLaterVariant: Story = {
377371 buttonColour : stringToHexColour ( 'F1F8FC' ) ,
378372 } ,
379373 } ,
380- tracking : {
381- ...tracking ,
382- abTestVariant : 'COLLAPSABLE_V2_MAYBE_LATER' ,
383- } ,
374+ tracking,
384375 choiceCardAmounts : regularChoiceCardAmounts ,
385376 choiceCardsSettings,
386377 tickerSettings,
387378 separateArticleCountSettings : {
388379 type : 'above' ,
389380 } ,
381+ isCollapsible : true ,
390382 } ,
391383} ;
You can’t perform that action at this time.
0 commit comments