From 490526cf1316a4ca7f7d78df6fd0c76419920d8d Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Mon, 1 May 2023 14:45:36 +0300 Subject: [PATCH] TCA-1279 - hide header & footer for hiring manager view in modal mode --- .../hiring-manager-view/HiringManagerView.tsx | 17 ++-------------- .../UserCertificationViewBase.tsx | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.tsx b/src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.tsx index 896cee6ea..33577b53c 100644 --- a/src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.tsx +++ b/src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.tsx @@ -5,7 +5,6 @@ import { ReactNode, SetStateAction, useCallback, - useLayoutEffect, useMemo, useRef, useState, @@ -36,7 +35,7 @@ import { useTCAShareCertificateModal, } from '..' import { getTCACertificationPath, getUserTCACertificateSsr } from '../../learn.routes' -import { clearFCCCertificationTitle, hideSiblings } from '../functions' +import { clearFCCCertificationTitle } from '../functions' import { EnvironmentConfig } from '../../../../config' import { CertificateModal } from './certificate-modal' @@ -68,7 +67,6 @@ export interface HiringManagerViewProps { // eslint-disable-next-line complexity const HiringManagerView: FC = (props: HiringManagerViewProps) => { const certificateElRef: MutableRefObject = useRef() - const wrapElRef: MutableRefObject = useRef() const [certPreviewModalIsOpen, setCertPreviewModalIsOpen]: [boolean, Dispatch>] = useState(false) @@ -253,19 +251,8 @@ const HiringManagerView: FC = (props: HiringManagerViewP ) } - useLayoutEffect(() => { - const el: HTMLElement = wrapElRef.current - if (!el || !props.isModalView) { - return - } - - hideSiblings(el.parentElement as HTMLElement) - hideSiblings(el.parentElement?.parentElement as HTMLElement) - - }) - return !!props.certification && !!props.userProfile ? ( -
+
{renderHero()} = (props: UserCertificationViewBaseProps) => { const [queryParams]: [URLSearchParams, any] = useSearchParams() + const wrapElRef: MutableRefObject = useRef() const tcaCertificationPath: string = getTCACertificationPath(`${props.certification?.dashedName}`) const certificateElRef: MutableRefObject = useRef() @@ -55,6 +58,15 @@ const UserCertificationViewBase: FC = (props: Us .then(verified => setIsMemberVerified(verified)) }, [props.enrollment]) + useLayoutEffect(() => { + const el: HTMLElement = wrapElRef.current + if (!el || !isModalView) { + return + } + + hideSiblings(el.parentElement as HTMLElement) + }, [isModalView]) + return ( <> @@ -74,8 +86,8 @@ const UserCertificationViewBase: FC = (props: Us )} - {props.profile && props.certification && props.enrollment && ( -
+
+ {props.profile && props.certification && props.enrollment && ( = (props: Us isPreview={props.isPreview} isModalView={isModalView} /> -
- )} + )} +
) }