From 26b45134148ef53317d0d2b9bf459f5b1e6a401f Mon Sep 17 00:00:00 2001 From: sunhpark42 <67677561+sunhpark42@users.noreply.github.com> Date: Sat, 9 Oct 2021 16:54:01 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=95=A8=EC=88=98=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=20=EC=8B=9C=20=EC=9E=98=EB=AA=BB=20=EC=A0=81=EC=9A=A9=EB=90=9C?= =?UTF-8?q?=20=EB=B6=80=EB=B6=84=20=ED=95=B4=EA=B2=B0=20=EB=B0=8F=20reload?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: getTextColor의 파라미터가 undefined일 때 오류 처리 로직 추가 및 Chip.styles에 잘못적용된 부분 수정 * fix: NavBar 로고 클릭 시 reload 삭제 --- frontend/src/components/Chip/Chip.styles.js | 3 ++- frontend/src/components/NavBar/NavBar.js | 5 ++--- frontend/src/utils/textColorPicker.js | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Chip/Chip.styles.js b/frontend/src/components/Chip/Chip.styles.js index 442c7bb47..07ceb7718 100644 --- a/frontend/src/components/Chip/Chip.styles.js +++ b/frontend/src/components/Chip/Chip.styles.js @@ -6,7 +6,8 @@ const Container = styled.div` width: ${({ width }) => (width ? width : 'fit-content')}; max-width: ${({ maxWidth }) => maxWidth}; background-color: ${({ backgroundColor }) => backgroundColor ?? COLOR.LIGHT_GRAY_200}; - color: ${({ backgroundColor }) => getTextColor(backgroundColor) ?? COLOR.BLACK_900}; + color: ${({ backgroundColor }) => + backgroundColor ? getTextColor(backgroundColor) : COLOR.BLACK_900}; padding: 0.2rem 0.8rem; border-radius: 5rem; margin-right: 1rem; diff --git a/frontend/src/components/NavBar/NavBar.js b/frontend/src/components/NavBar/NavBar.js index f70520cd3..9000646cd 100644 --- a/frontend/src/components/NavBar/NavBar.js +++ b/frontend/src/components/NavBar/NavBar.js @@ -53,9 +53,8 @@ const NavBar = () => { } }, [user]); - const goMainWithReload = () => { + const goMain = () => { history.push(PATH.ROOT); - window.location.reload(); }; const goNewPost = async () => { @@ -124,7 +123,7 @@ const NavBar = () => { return ( - + PROLOG 로고 {process.env.REACT_APP_MODE === 'PROD' ? 'BETA' : process.env.REACT_APP_MODE} diff --git a/frontend/src/utils/textColorPicker.js b/frontend/src/utils/textColorPicker.js index 197b64d85..10816e9f3 100644 --- a/frontend/src/utils/textColorPicker.js +++ b/frontend/src/utils/textColorPicker.js @@ -1,6 +1,10 @@ import { COLOR } from '../constants'; function getTextColor(hexColor) { + if (!hexColor) { + return `${COLOR.BLACK_900}`; + } + const rgb = parseInt(hexColor.substring(1), 16); const r = (rgb >> 16) & 0xff;