diff --git a/frontend/components/application/applicationNode/NextButton.component.tsx b/frontend/components/application/applicationNode/NextButton.component.tsx index 0388b927..52edf877 100644 --- a/frontend/components/application/applicationNode/NextButton.component.tsx +++ b/frontend/components/application/applicationNode/NextButton.component.tsx @@ -13,34 +13,29 @@ interface ApplicationNextButtonProps { isLast?: boolean; } +// etc. 단순히 boolean이 아닌 어느 곳에서 터지는 지와 그 이유를 담은 객체를 반환하면 어떨까? // TODO: 질문의 이름마다 side effect가 있으니 주의하면 좋을 것 -const canNext = (applicationName: Array) => { - return applicationName.every((name) => { +const canNext = (applicationNames: Array) => { + return applicationNames.every((name) => { + const EMPTY_STRING: string = ""; + const localStorageValueFromName = localStorage.get(name, EMPTY_STRING); + if ( name === "personalInformationAgreeForPortfolio" || name === "personalInformationAgree" ) { - return ( - localStorage.get(name) !== "동의하지 않습니다." && - localStorage.get(name, "") !== "" - ); + return localStorageValueFromName === "동의합니다."; } if (name === "email") { - return isEmail(localStorage.get(name, "")); + return isEmail(localStorageValueFromName); } if (name === "check") { - return localStorage.get(name) === "확인했습니다"; - } - if (localStorage.get(name, "").length === 0) { - if ( - name === "channel" && - localStorage.get("channelEtc", "").length !== 0 - ) { - return true; - } - return false; + return localStorageValueFromName === "확인했습니다"; } - return true; + return ( + !(localStorageValueFromName.length === 0) || + (name === "channel" && localStorage.get("channelEtc", EMPTY_STRING).length !== 0) + ); }); }; @@ -57,7 +52,7 @@ const ApplicationNextButton = ({ ); if (!canNext(Array.from(applicationName))) { alert("필수 항목을 입력해주세요."); - return false; + return; } if (isLast) { diff --git a/frontend/components/common/navbar/Button.tsx b/frontend/components/common/navbar/Button.tsx index 867fa626..7d7530f5 100644 --- a/frontend/components/common/navbar/Button.tsx +++ b/frontend/components/common/navbar/Button.tsx @@ -2,6 +2,7 @@ import { KANBAN_MENU } from "@/src/constants/kanban/26"; import { KanbanSelectedButtonNumberState } from "@/src/stores/kanban/Navbar.atoms"; +import { cn } from "@/src/utils/cn"; import { useAtom } from "jotai"; type NavbarButtonProps = { @@ -14,19 +15,19 @@ const NavbarButton = ({ value }: NavbarButtonProps) => { const findmenuIndex = KANBAN_MENU.findIndex((menu) => menu.navTitle === value) + 1; - const buttonClassName = " py-2 px-6 rounded-lg min-w-fit "; + const buttonClassName = "py-2 px-6 rounded-lg min-w-fit"; const onClick = () => { setnavbarId(findmenuIndex.toString()); }; + const isButtonSelected = navbarId === findmenuIndex.toString(); return (