From 183b2865401b37ff5afb2aa2ea359f05159ee6b7 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Aug 2022 22:22:05 +0900 Subject: [PATCH 01/19] fix: Project List Search Function --- src/pages/projects/list.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/projects/list.tsx b/src/pages/projects/list.tsx index a1db893..98ee083 100644 --- a/src/pages/projects/list.tsx +++ b/src/pages/projects/list.tsx @@ -65,6 +65,8 @@ function ProjectList() { function onInputChange(e: React.ChangeEvent) { const currentValue = e.target.value; setInput(currentValue); + setEnterPressed(false); + setSearchResult([]); } /* ------------------------------------------------------------- */ @@ -85,12 +87,6 @@ function ProjectList() { }), setInput(''); searchinput.blur(); - } else { - // 빈칸 입력 시, 전체 프로젝트 리스트 띄워줌 - setEnterPressed(true); - setSearchResult([]); - - return; } } /* ---------------------------------------------------------------- */ From c937ac8ce72363ee3a49465a9a6b0118da5b39b3 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Aug 2022 22:23:53 +0900 Subject: [PATCH 02/19] refactor: Project Stack Search Function --- src/pages/projects/edit.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/projects/edit.tsx b/src/pages/projects/edit.tsx index 02eed34..c5fb476 100644 --- a/src/pages/projects/edit.tsx +++ b/src/pages/projects/edit.tsx @@ -33,6 +33,7 @@ const ProjectEdit: NextPage = () => { function onInputChange(e: React.ChangeEvent) { const currentValue = e.target.value; setInput(currentValue); + setEnterPressed(false); } function searchStacks(e: React.KeyboardEvent) { const keyword = input; From 4bb9aa2ab196b727d74c1bee481340b07c507677 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Aug 2022 23:15:04 +0900 Subject: [PATCH 03/19] refactor: remove unused variables from Header --- src/components/Header.tsx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 558d53a..d4ca5e0 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -2,11 +2,9 @@ import React from 'react'; import { BsPerson } from 'react-icons/bs'; import { FiMenu } from 'react-icons/fi'; import { MdOutlineClose } from 'react-icons/md'; -import { FiLogOut } from 'react-icons/fi'; import Link from 'next/link'; import { loginRecoilState } from '../recoil/loginuser'; import { useRecoilState } from 'recoil'; -import { axiosInstance } from '../hooks/queries'; function SideMenu({ theme }: { theme?: 'dark' | 'light' }) { const [loginUserData, setLoginUserData] = useRecoilState(loginRecoilState); @@ -14,9 +12,8 @@ function SideMenu({ theme }: { theme?: 'dark' | 'light' }) { function closeMenu() { if (typeof window !== 'undefined') { const sidebg = document.getElementById('sidebg'); - const wrapper = document.getElementById('wrapper'); const sidebar = document.getElementById('sidebar'); - //wrapper?.classList.remove('z-[110]'); + sidebg?.classList.replace('visible', 'invisible'); sidebg?.classList.remove('backdrop-blur-sm'); sidebg?.classList.replace('bg-black/20', 'bg-black/0'); @@ -58,9 +55,8 @@ function Header({ theme }: { theme?: 'dark' | 'light' }) { function openMenu() { if (typeof window !== 'undefined') { const sidebg = document.getElementById('sidebg'); - const wrapper = document.getElementById('wrapper'); const sidebar = document.getElementById('sidebar'); - //wrapper?.classList.add('z-[110]'); + sidebg?.classList.replace('invisible', 'visible'); sidebg?.classList.add('backdrop-blur-sm'); sidebg?.classList.replace('bg-black/0', 'bg-black/20'); @@ -68,14 +64,6 @@ function Header({ theme }: { theme?: 'dark' | 'light' }) { } } - // async function handleLogOut() { - // await axiosInstance.get('/auth/logout'); - // setLoginUserData({ - // isLogin: false, - // user: null, - // }); - // } - return ( <> @@ -108,7 +96,6 @@ function Header({ theme }: { theme?: 'dark' | 'light' }) { - {/* {loginUserData.isLogin ? : null} */} From 045bf6f4ed13a78f18cb98caa7e99fb0da5fec24 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Aug 2022 23:58:06 +0900 Subject: [PATCH 04/19] feat: modal close when black background clicked --- src/components/Header.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index d4ca5e0..f204e80 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { BsPerson } from 'react-icons/bs'; import { FiMenu } from 'react-icons/fi'; import { MdOutlineClose } from 'react-icons/md'; @@ -9,6 +9,16 @@ import { useRecoilState } from 'recoil'; function SideMenu({ theme }: { theme?: 'dark' | 'light' }) { const [loginUserData, setLoginUserData] = useRecoilState(loginRecoilState); + useEffect(() => { + const sidebg = document.getElementById('sidebg'); + + window.addEventListener('click', e => { + if (e.target === sidebg) { + closeMenu(); + } + }); + }, []); + function closeMenu() { if (typeof window !== 'undefined') { const sidebg = document.getElementById('sidebg'); From 63db3f19328be3211fda26e56dab1df09df1d1d7 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Fri, 26 Aug 2022 00:01:38 +0900 Subject: [PATCH 05/19] feat: add another onClick function for study --- src/components/Header.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index f204e80..610609d 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -9,15 +9,15 @@ import { useRecoilState } from 'recoil'; function SideMenu({ theme }: { theme?: 'dark' | 'light' }) { const [loginUserData, setLoginUserData] = useRecoilState(loginRecoilState); - useEffect(() => { - const sidebg = document.getElementById('sidebg'); + // useEffect(() => { + // const sidebg = document.getElementById('sidebg'); - window.addEventListener('click', e => { - if (e.target === sidebg) { - closeMenu(); - } - }); - }, []); + // window.addEventListener('click', e => { + // if (e.target === sidebg) { + // closeMenu(); + // } + // }); + // }, []); function closeMenu() { if (typeof window !== 'undefined') { @@ -32,8 +32,8 @@ function SideMenu({ theme }: { theme?: 'dark' | 'light' }) { } return (
-
-