Skip to content

Commit

Permalink
Refactor : 전역 컨텍스트 삭제, Event capture 로 대체
Browse files Browse the repository at this point in the history
  • Loading branch information
jobkaeHenry committed Dec 5, 2023
1 parent 6088a4a commit 294b359
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
9 changes: 2 additions & 7 deletions client/src/components/Navigation/NavigationBar.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -24,8 +23,6 @@ const NavigationBar = () => {
const path = usePathname();
const { data: userInfo } = useMyInfoQuery();

const isVisible = useGlobalNavbarVisibility(({ isVisible }) => isVisible);

const NavbarData = useMemo(
() => [
{
Expand Down Expand Up @@ -55,7 +52,7 @@ const NavigationBar = () => {
],
[userInfo]
);
return isVisible ? (
return (
<BottomNavigation value={path} showLabels sx={BtnStyle}>
{NavbarData.map(({ label, href, iconComponent, ...others }) => {
return (
Expand All @@ -71,8 +68,6 @@ const NavigationBar = () => {
);
})}
</BottomNavigation>
) : (
<></>
);
};

Expand Down
13 changes: 4 additions & 9 deletions client/src/components/post/detail/PostCommentInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand All @@ -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}
>
<TextField
fullWidth
onFocus={() => {
setIsShowingNavbar(false);
setIsEditing(true);
}}
onBlur={() => {
setIsShowingNavbar(true);
setIsEditing(false);
}}
size="small"
Expand All @@ -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",
Expand Down
15 changes: 0 additions & 15 deletions client/src/store/useGlobalNavbarVisibility.ts

This file was deleted.

0 comments on commit 294b359

Please sign in to comment.