All files / src/sections/PayBuilder/components/products/Hero HeroSelector.tsx

100% Statements 6/6
100% Branches 6/6
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                              22x   22x 7x 15x 3x 12x        
import ProductHero from "./ProductHero";
import DonationTypeHero from "./DonationTypeHero";
import useCheckFormType from "../../hooks/useCheckFormType";
import React, { memo } from "react";
import EventsHero from "./EventsHero";
 
function HeroSelector({
  isPreview,
  isPeekMode,
  ADBContent,
}: {
  isPreview?: boolean;
  ADBContent?: React.ReactElement;
  isPeekMode?: boolean;
}) {
  const { isFundraiser, isSweepstake, isEvent } = useCheckFormType();
 
  if (isFundraiser || isSweepstake)
    return <DonationTypeHero isPreview={isPreview} ADBContent={ADBContent} />;
  if (isEvent)
    return <EventsHero isPreview={isPreview} isPeekMode={isPeekMode} />;
  return <ProductHero isPreview={isPreview} />;
}
 
export default memo(HeroSelector);