import React, { useLayoutEffect, useRef, useState } from 'react'; import { useSelector } from 'react-redux'; import { NavLink } from 'react-router-dom'; import { isSurveyActive } from 'app/modules/survey/store/survey.selectors'; import { TopNavTabList } from './topNavTabList'; import { ROUTER, userPanelRoute } from 'app/common/routes'; import { ProfilePopUp } from 'app/modules/navigation/components/profilePopUp'; import { ContrastButton } from 'app/shared/components/contrastButton/contrastButton'; import { SurveyPopup } from 'app/shared/components/topBar/surveyPopup'; import cx from 'classnames'; import { selectUserPools } from 'app/modules/user/store/user.selectors'; import { selectUpdateNotifications } from 'app/modules/notifications/store/updateNotification/updateNotifications.selectors'; interface Props { section?: string; withoutNavItems?: boolean; additionalRouteParams?: { [key: string]: string; } } const TopNavigation = ({ section, withoutNavItems, additionalRouteParams }: Props) => { const surveyActive = useSelector(isSurveyActive); const [ isSurveyVisible, setSurveyVisibility ] = useState(false); const [ isShadowVisible, setShadowVisibility ] = useState(false); const userPools = useSelector(selectUserPools); const updateNotifications = useSelector(selectUpdateNotifications); const topNavRef = useRef(null); const Logo = {'Maersk'} {'Maersk'} ; const handleScroll = () => { if (topNavRef) { if (window.scrollY === 0) { setShadowVisibility(false); } else if (window.scrollY > 0) { setShadowVisibility(true); } } }; useLayoutEffect(() => { window.addEventListener('scroll', handleScroll); return () => { window.removeEventListener('scroll', handleScroll); }; }, [ topNavRef ]); return ( ); }; export { TopNavigation };