From 04bee8d201fb2fb94fca4ca1c6e10a2bf5de0b44 Mon Sep 17 00:00:00 2001 From: Evgeniy Nagalskiy Date: Tue, 19 Jan 2021 13:32:31 +0200 Subject: [PATCH 1/6] done --- src/components/app/header.tsx | 12 ++++++------ src/pages/lessons/[slug].tsx | 10 +++++----- src/utils/breakpoints.ts | 28 +++++++++++++--------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/components/app/header.tsx b/src/components/app/header.tsx index 25611a08e..121ff2845 100644 --- a/src/components/app/header.tsx +++ b/src/components/app/header.tsx @@ -6,7 +6,7 @@ import {useViewer} from 'context/viewer-context' import {track} from 'utils/analytics' import {isEmpty} from 'lodash' import Feedback from 'components/feedback-input' -import useBreakpoint from 'utils/breakpoints' +import breakpoints from 'utils/breakpoints' import {useRouter} from 'next/router' const ACCOUNT_LINK_ENABLED = @@ -15,12 +15,12 @@ const ACCOUNT_LINK_ENABLED = const Header: FunctionComponent = () => { const router = useRouter() const {viewer, loading} = useViewer() - const {sm} = useBreakpoint() + const {isMinSM} = breakpoints() const [isOpen, setOpen] = React.useState(false) React.useEffect(() => { - !sm ? setOpen(sm) : setOpen(false) - }, [sm, router]) + !isMinSM ? setOpen(isMinSM) : setOpen(false) + }, [isMinSM, router]) const Navigation: FunctionComponent<{ className?: string @@ -142,8 +142,8 @@ const Header: FunctionComponent = () => { - {!sm && } - {sm && !loading && ( + {isMinSM && } + {!isMinSM && !loading && (