Skip to content

Commit

Permalink
chore: 모달 기능 틀 잡기
Browse files Browse the repository at this point in the history
  • Loading branch information
Arooming committed Jan 17, 2024
1 parent 9b38945 commit 1ef1d30
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/components/common/Modal/CommonModalForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';

import { MODAL_CONTETNS } from '../constants/ModalContents';
import * as S from './CommonModalForm.style';
Expand All @@ -9,7 +10,30 @@ interface CommonModalFormProps {
}

function CommonModalForm({ onClose, category }: CommonModalFormProps) {
const navigate = useNavigate();
const [idx, setIdx] = useState(0);

const handleClickRightBtn = () => {
onClose();
switch (category) {
case 'note_complete':
break;
case 'note_escape':
break;
case 'book_escape':
break;
case 'book_create':
break;
case 'book_delete':
break;
case 'login':
navigate('/login');
break;
default:
break;
}
};

useEffect(() => {
switch (category) {
case 'note_complete':
Expand Down Expand Up @@ -47,7 +71,11 @@ function CommonModalForm({ onClose, category }: CommonModalFormProps) {
</S.Button>
)}

<S.Button type="button" variant="continue" onClick={onClose}>
<S.Button
type="button"
variant="continue"
onClick={handleClickRightBtn}
>
{MODAL_CONTETNS[idx].rightBtn}
</S.Button>
</S.BtnWrapper>
Expand Down

0 comments on commit 1ef1d30

Please sign in to comment.