Skip to content

Commit

Permalink
add discount onClick and eligibility check
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewHEguardian committed Nov 16, 2023
1 parent c7030e9 commit 7bd05b7
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import type {
} from '../../CancellationContainer';
import { CancellationContext } from '../../CancellationContainer';

const Offer = () => (
const DiscountOffer = ({
handleDiscountOfferClick,
}: {
handleDiscountOfferClick: () => void;
}) => (
<Stack
space={4}
css={css`
Expand Down Expand Up @@ -75,7 +79,10 @@ const Offer = () => (
</div>
<div css={buttonContainerCss}>
<ThemeProvider theme={buttonThemeReaderRevenueBrand}>
<Button cssOverrides={buttonCentredCss}>
<Button
cssOverrides={buttonCentredCss}
onClick={handleDiscountOfferClick}
>
Keep support with discount
</Button>
</ThemeProvider>
Expand All @@ -102,6 +109,10 @@ export const ThankYouOffer = () => {
'yyyy',
);

const hasDiscountLive = false; // ToDo
const hasPaymentFailure = !!productDetail.alertText;
const eligibleForDiscount = !hasDiscountLive && !hasPaymentFailure;

return (
<section
css={css`
Expand Down Expand Up @@ -138,7 +149,13 @@ export const ThankYouOffer = () => {
world. We're so grateful.
</p>
</Stack>
<Offer />
{eligibleForDiscount && (
<DiscountOffer
handleDiscountOfferClick={() =>
navigate('todo', { state: { ...routerState } })
}
/>
)}
<div>
<h3
css={css`
Expand Down

0 comments on commit 7bd05b7

Please sign in to comment.