import React from 'react'; import './pdp_promo_banner.scss'; type PromoBannerType = 'new-client'; interface Props { code?: string; discount: string; restrictions?: boolean; type: PromoBannerType; } const getFirstPurchaseText = ( discount: string, code: string, restrictions?: boolean ) => ( <> TAKE {discount} OFF YOUR FIRST PURCHASE WITH CODE{' '} {code}. {' '} {restrictions && ( RESTRICTIONS APPLY )} ); const getInnerContent = ({...props}: Props) => { switch (props.type) { case 'new-client': { return getFirstPurchaseText( props.discount, props.code, props.restrictions ); } } }; export const PdpPromoBanner: React.FC = ({...props}) => (
{getInnerContent(props)}
);