Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
domlander committed Nov 18, 2024
1 parent 0c4114f commit 18698a4
Showing 1 changed file with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ type Variant = {
heading: string;
kicker: string;
};
const variantBubble: Variant = {
heading: 'Pop your US news bubble',
kicker: 'How the Guardian is different',
};
const variantFree: Variant = {
heading: 'Yes, this story is free',
kicker: 'Why the Guardian has no paywall',
};
const variantBubble: Variant = {
heading: 'Pop your US news bubble',
kicker: 'How the Guardian is different',
};
const variantBillionaire: Variant = {
heading: 'No billionaire approved this',
kicker: 'How the Guardian is different',
Expand Down Expand Up @@ -62,23 +62,14 @@ const getVariant = (abTestAPI: ABTestAPI | undefined): VariantName | null => {

const getVariantCopy = (variant: VariantName): Variant => {
if (variant === 'variant-free') {
return {
heading: variantFree.heading,
kicker: variantFree.kicker,
};
return variantFree;
}

if (variant === 'variant-bubble') {
return {
heading: variantBubble.heading,
kicker: variantBubble.kicker,
};
return variantBubble;
}

return {
heading: variantBillionaire.heading,
kicker: variantBillionaire.kicker,
};
return variantBillionaire;
};

const isFirstOrSecondArticle = () => {
Expand Down

0 comments on commit 18698a4

Please sign in to comment.