diff --git a/packages/modules/src/modules/banners/choiceCardsButtonsBanner/components/ChoiceCards.tsx b/packages/modules/src/modules/banners/choiceCardsButtonsBanner/components/ChoiceCards.tsx index 40e2dca16..e3cf8dbdc 100644 --- a/packages/modules/src/modules/banners/choiceCardsButtonsBanner/components/ChoiceCards.tsx +++ b/packages/modules/src/modules/banners/choiceCardsButtonsBanner/components/ChoiceCards.tsx @@ -31,10 +31,11 @@ interface ChoiceCardProps { numArticles?: number; content?: BannerTextContent; cssCtaOverides?: SerializedStyles; + verticalPosAdjust?: number; } const styles = { - container: css` + container: (verticalPosAdjust?: number) => css` // This position: relative is necessary to stop it jumping to the top of the page when a button is clicked position: relative; margin: ${space[3]}px 0 ${space[5]}px; @@ -53,13 +54,13 @@ const styles = { } ${from.tablet} { - margin: 108px 0 ${space[5]}px; + margin: ${verticalPosAdjust ?? 108}px 0 ${space[5]}px; } ${from.desktop} { min-height: 208px; max-width: 380px; - margin-top: 120px; + margin-top: ${verticalPosAdjust ?? 120}px; } `, bannerFrequenciesGroupOverrides: css` @@ -139,6 +140,7 @@ export const ChoiceCards: React.FC = ({ numArticles, getCtaText, cssCtaOverides, + verticalPosAdjust, }: ChoiceCardProps) => { if (!selection || !amounts) { return <>; @@ -166,7 +168,7 @@ export const ChoiceCards: React.FC = ({ }, [hasBeenSeen, submitComponentEvent]); return ( -
+
(); + useEffect(() => { + function handleResize() { + setHeaderHeight(getHeightHeader('headerContainer')); + } + window.addEventListener('resize', handleResize); + handleResize(); + return () => window.removeEventListener('resize', handleResize); + }, []); + const { isReminderActive, onReminderCtaClick, mobileReminderRef } = useReminder( reminderTracking, ); @@ -103,6 +118,7 @@ export function getMomentTemplateBanner( numArticles={numArticles} content={content} getCtaText={getCtaText} + verticalPosAdjust={headerHeight} /> )}
@@ -116,6 +132,7 @@ export function getMomentTemplateBanner( SecondaryCtaType.ContributionsReminder, templateSettings.choiceCards, )} + id="headerContainer" >