From c31c5dfe66adce1f60d3b41e54da40565f943b0d Mon Sep 17 00:00:00 2001 From: Defectink Date: Wed, 6 Apr 2022 16:23:38 +0800 Subject: [PATCH] Fix height on mobile --- components/NavBar.tsx | 10 +++++++--- pages/index.tsx | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/components/NavBar.tsx b/components/NavBar.tsx index 2c3f1a8..c7cdd69 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -1,6 +1,6 @@ import cn from 'classnames'; import Link from 'next/link'; -import { FC, useState } from 'react'; +import { FC, useCallback, useState } from 'react'; import { FiMenu } from 'react-icons/fi'; import dynamic from 'next/dynamic'; @@ -26,6 +26,9 @@ const txtMenu = [ const HeadBar: FC = () => { const [showMenu, setShowMenu] = useState(false); + const handleClick = useCallback(() => { + setShowMenu((showMenu) => !showMenu); + }, []); return ( <> @@ -51,7 +54,7 @@ const HeadBar: FC = () => { setShowMenu(!showMenu)} + onClick={handleClick} />