From 8699a52b2d1c8ca2dc45f07faf14983b6efd2d0c Mon Sep 17 00:00:00 2001 From: Roger Date: Tue, 7 Jul 2020 22:47:14 -0400 Subject: [PATCH] CML alert bar extra fixes (#1545) * Add an alert box above the header to advertise CML Not the most reusable implementation, but it does the job. * Update index.tsx * Update styles.module.css * Update index.tsx * Update index.tsx * Update index.tsx * Fix Alert+Nav issue Since the nav menu isn't in the header's tree, this fix has the menu icon invoke the header hook separately and restyle itself alongside the header. Co-authored-by: Ivan Shcheklein --- src/components/HamburgerMenu/index.tsx | 4 +++- src/components/HamburgerMenu/styles.module.css | 5 +++++ src/components/LayoutHeader/index.tsx | 5 ++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/HamburgerMenu/index.tsx b/src/components/HamburgerMenu/index.tsx index 3c7c0e1d1b..9a2a76d850 100644 --- a/src/components/HamburgerMenu/index.tsx +++ b/src/components/HamburgerMenu/index.tsx @@ -9,6 +9,7 @@ import { getFirstPage } from '../../utils/shared/sidebar' import { ReactComponent as LogoSVG } from '../../../static/img/logo-white.svg' import { ReactComponent as TwitterIcon } from '../SocialIcon/twitter.svg' import { ReactComponent as GithubIcon } from '../SocialIcon/github.svg' +import { useHeaderIsScrolled } from '../../utils/front/scroll' import styles from './styles.module.css' @@ -16,6 +17,7 @@ const docsPage = getFirstPage() const HamburgerMenu: React.FC = () => { const [isOpened, setOpened] = useState(false) + const collapsed = useHeaderIsScrolled() const toggleMobileMenu = useCallback(() => setOpened(!isOpened), [isOpened]) const openOnEnterKey = useCallback(e => { @@ -42,7 +44,7 @@ const HamburgerMenu: React.FC = () => { return (