import React, { FC, useEffect, useState, ReactType, useRef } from 'react'; import Layout from '../../components/Layout'; import css from './index.module.css'; import { LinkProps } from '../../index'; import IconDownArrowSVG from '../../assets/icons/icon-down-arrow.svg'; import { RatingHeader, RatingFooter } from '../../helpers/ratingHelper'; export interface RatingPageProps { CustomerFeedbackForm?: ReactType; PartnerFeedbackForm?: ReactType; LinkProps?: LinkProps; translations?: { headerTitle?: string; headerSubtitle?: string; milaflowTitle?: string; milaflowSubTitlePart1?: string; milaflowSubTitlePart2?: string; milaflowSubtitle?: string; milaflowText1?: string; milaflowText2?: string; milaflowText3?: string; dearText?: string; partnerHeaderSubtitle?: string; sendFeedbackMessage?: string; }; isPartner?: boolean; partnerName?: string; milaFlowImages?: { milaflowImageStep1?: string; milaflowImageStep2?: string; milaflowImageStep3?: string; }; EnterprisePartnerName?: string; isSubmitted?: boolean; } const RatingPageTemplate: FC = ({ LinkProps, translations, isPartner, partnerName, milaFlowImages, EnterprisePartnerName, children, isSubmitted, }) => { const milaflowTitle = useRef(null); const [getMilaFlowTitle, setMilaFlowTitle] = useState(false); useEffect(() => { if (isSubmitted == true) { window.scrollTo({ top: 0, behavior: 'smooth', }); } }, [isSubmitted]); useEffect(() => { if (getMilaFlowTitle == true) { const item = milaflowTitle.current; // Substract header height in offfset window.scrollTo({ top: item.offsetTop, behavior: 'smooth', }); setTimeout(() => { setMilaFlowTitle(false); }, 200); } }, [getMilaFlowTitle]); return ( <>

{!isPartner && translations.headerTitle} {isPartner && ( <> {translations.headerTitle},
{partnerName} )}

{!isPartner && translations.headerSubtitle} {isPartner && translations.partnerHeaderSubtitle}
{!isPartner && (
{ setMilaFlowTitle(true); }} > {translations.milaflowTitle}{' '} {' '}
)}
{children} {!isPartner && (
)}
); }; export default RatingPageTemplate;