From 294b3590f5c92209896644443b00ce7ba4e9f568 Mon Sep 17 00:00:00 2001 From: Jungu Lee <1zzangjun@gmail.com> Date: Tue, 5 Dec 2023 13:30:19 +0900 Subject: [PATCH] =?UTF-8?q?Refactor=20:=20=EC=A0=84=EC=97=AD=20=EC=BB=A8?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=82=AD=EC=A0=9C,=20Event=20cap?= =?UTF-8?q?ture=20=EB=A1=9C=20=EB=8C=80=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Navigation/NavigationBar.tsx | 9 ++------- .../components/post/detail/PostCommentInput.tsx | 13 ++++--------- client/src/store/useGlobalNavbarVisibility.ts | 15 --------------- 3 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 client/src/store/useGlobalNavbarVisibility.ts diff --git a/client/src/components/Navigation/NavigationBar.tsx b/client/src/components/Navigation/NavigationBar.tsx index 122b669..d2cb3c2 100644 --- a/client/src/components/Navigation/NavigationBar.tsx +++ b/client/src/components/Navigation/NavigationBar.tsx @@ -1,11 +1,10 @@ "use client"; -import { BottomNavigation, BottomNavigationAction, Paper } from "@mui/material"; +import { BottomNavigation, BottomNavigationAction } from "@mui/material"; import HomeIcon from "~/assets/icons/HomeIcon.svg"; import SearchIcon from "~/assets/icons/SearchIcon.svg"; import PostIcon from "~/assets/icons/PostIcon.svg"; import BeverageIcon from "~/assets/icons/BeverageIcon.svg"; -import { useGlobalNavbarVisibility } from "@/store/useGlobalNavbarVisibility"; import HOME, { MY_PROFILE, @@ -24,8 +23,6 @@ const NavigationBar = () => { const path = usePathname(); const { data: userInfo } = useMyInfoQuery(); - const isVisible = useGlobalNavbarVisibility(({ isVisible }) => isVisible); - const NavbarData = useMemo( () => [ { @@ -55,7 +52,7 @@ const NavigationBar = () => { ], [userInfo] ); - return isVisible ? ( + return ( {NavbarData.map(({ label, href, iconComponent, ...others }) => { return ( @@ -71,8 +68,6 @@ const NavigationBar = () => { ); })} - ) : ( - <> ); }; diff --git a/client/src/components/post/detail/PostCommentInput.tsx b/client/src/components/post/detail/PostCommentInput.tsx index 328eafe..2d155ff 100644 --- a/client/src/components/post/detail/PostCommentInput.tsx +++ b/client/src/components/post/detail/PostCommentInput.tsx @@ -2,14 +2,10 @@ import { InputAdornment, Paper, TextField } from "@mui/material"; import { useCallback, useContext, useState } from "react"; import SubmitCommentIcon from "@/assets/icons/comment/SubmitCommentIcon.svg"; -import { useGlobalNavbarVisibility } from "@/store/useGlobalNavbarVisibility"; import PostDetailPageContext from "@/store/post/PostDetailPageContext"; import useNewPostCommentMutation from "@/queries/post/comment/useNewPostCommentMutation"; const PostCommentInput = () => { - const setIsShowingNavbar = useGlobalNavbarVisibility( - ({ setIsVisible }) => setIsVisible - ); const { data: currentData } = useContext(PostDetailPageContext); const [isEditing, setIsEditing] = useState(false); const [inputValue, setInputValue] = useState(""); @@ -33,22 +29,21 @@ const PostCommentInput = () => { border: "1px solid", borderColor: "gray.secondary", position: "fixed", - bottom: isEditing ? 0 : "44px", + bottom: isEditing ? 0 : 56, borderRadius: 1.5, left: 0, right: 0, p: 2, - pb: isEditing ? 2 : 3.5, + zIndex: 2, }} + elevation={0} > { - setIsShowingNavbar(false); setIsEditing(true); }} onBlur={() => { - setIsShowingNavbar(true); setIsEditing(false); }} size="small" @@ -64,7 +59,7 @@ const PostCommentInput = () => { position="end" onClick={(e) => { e.stopPropagation(); - submitHandler(inputValue) + submitHandler(inputValue); }} sx={{ color: inputValue.length > 0 ? "primary.main" : "text.disabled", diff --git a/client/src/store/useGlobalNavbarVisibility.ts b/client/src/store/useGlobalNavbarVisibility.ts deleted file mode 100644 index 070ea60..0000000 --- a/client/src/store/useGlobalNavbarVisibility.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { create } from "zustand"; - -interface GlobalNavbarVisibility { - isVisible: boolean; - setIsVisible: (val: boolean) => void; -} -/** - * 네비게이션바 (바텀네비게이션)을 표시할지 여부 - */ -export const useGlobalNavbarVisibility = create( - (set) => ({ - isVisible: true, - setIsVisible: (val) => set(() => ({ isVisible: val })), - }) -);