import React from 'react' import Button from 'react-bootstrap/Button' import SVG from 'react-inlinesvg' import DoneSvg from '../../assets/images/done.svg' import XmarkSvg from '../../assets/images/xmark.svg' export interface IPromoCodeSectionProps { code: string; codeIsApplied: boolean; showPromoInput: boolean; setCode: (value: string) => void; setShowPromoInput: (value: boolean) => void; updateTickets: (value: boolean, type: string) => void; setCodeIsApplied: (value: boolean) => void; codeIsInvalid: boolean; setCodeIsInvalid: (value: boolean) => void; promoText?: string; showAlertIcons?: boolean; } export const PromoCodeSection = ({ code, codeIsApplied, showPromoInput, setCode, setShowPromoInput, updateTickets, setCodeIsApplied, codeIsInvalid, setCodeIsInvalid, promoText, showAlertIcons }: IPromoCodeSectionProps) => { const isPromoCodeHasValue = !!code.trim() const appliedPromoCode = window?.localStorage?.getItem('appliedPromoCode') const renderInputField = () => (

Promo code

{ setCode(e.target.value) }} onKeyPress={event => { if (event.key === 'Enter' && isPromoCodeHasValue) { setShowPromoInput(false) updateTickets(true, 'promo') } }} />
) return (
{codeIsApplied ? (
{showAlertIcons && ( code.replace(/fill=".*?"/g, 'fill="currentColor"') } /> )}

PROMO CODE APPLIED SUCCESSFULLY

) : null} {codeIsApplied ? (

PROMO CODE: {appliedPromoCode}

) : null} {codeIsInvalid ? (
{showAlertIcons && ( )}

Invalid Promo Code

) : null} {!showPromoInput && ( )} {showPromoInput && renderInputField()}
) }