diff --git a/frontend/src/components/organisms/PreferenceModal/index.tsx b/frontend/src/components/organisms/PreferenceModal/index.tsx index 9f0b8bcf..68606bf2 100644 --- a/frontend/src/components/organisms/PreferenceModal/index.tsx +++ b/frontend/src/components/organisms/PreferenceModal/index.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { useRecoilState } from 'recoil'; import { preferenceModalState } from '@state/modal'; +import { PREFERENCE_MODAL_STATUS } from '@enum/index'; import PreferenceMenuContent from './PreferenceMenuContent'; import AboutUs from './AboutUs/AboutUs'; import ThemeSelect from './ThemeSelect'; @@ -14,14 +15,19 @@ import { RowDiv, } from './styles'; -const selectedContent = ({ isClicked }: { isClicked: number }): JSX.Element => { - switch (isClicked) { - case 1: +const { ABOUT, THEME, OUT } = PREFERENCE_MODAL_STATUS; + +const selectedContent = ({ + currentPreferenceStatus, +}: { + currentPreferenceStatus: number; +}): JSX.Element => { + switch (currentPreferenceStatus) { + case ABOUT: return ; - case 2: + case THEME: return ; - case 3: - return ; + case OUT: default: return ; } @@ -29,7 +35,7 @@ const selectedContent = ({ isClicked }: { isClicked: number }): JSX.Element => { const PreferenceModal = (): JSX.Element => { const [isOpen, setIsOpen] = useRecoilState(preferenceModalState); - const [isClicked, setClick] = useState(1); + const [currentPreferenceStatus, setClick] = useState(ABOUT); return ( setIsOpen(false)} zIndex={100}> @@ -38,27 +44,27 @@ const PreferenceModal = (): JSX.Element => { setClick(1)} + isClicked={currentPreferenceStatus} + index={ABOUT} + onClick={() => setClick(ABOUT)} text="About us" /> setClick(2)} + isClicked={currentPreferenceStatus} + index={THEME} + onClick={() => setClick(THEME)} text="테마 설정" /> setClick(3)} + onClick={() => setClick(OUT)} text="워크스페이스 탈퇴" /> - {selectedContent({ isClicked })} + {selectedContent({ currentPreferenceStatus })} diff --git a/frontend/src/enum/index.ts b/frontend/src/enum/index.ts index 59194e7b..0719c2b1 100644 --- a/frontend/src/enum/index.ts +++ b/frontend/src/enum/index.ts @@ -21,3 +21,5 @@ export const CHANNELTYPE = { 1: '🔒', 0: '#', } as const; + +export const PREFERENCE_MODAL_STATUS = { ABOUT: 1, THEME: 2, OUT: 3 };