Merged
Conversation
- useAlert 커스텀훅 작업 - 전역적으로 관리할 dialog store 및 container 작업
Closed
2 tasks
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ToKyun02
reviewed
Feb 7, 2025
Owner
ToKyun02
left a comment
There was a problem hiding this comment.
모달 구현하시느라 고생많으셨습니다!
모달의 열고 닫는 동작되는지 확인했고, 전체적으로 재사용성을 많이 고려하신 것 같아 배울 점이 많았던 것 같습니다!
실제로 코드를 짜는 가정으로 테스트 코드를 작성해봤었는데, Header와 Footer의 내용을 ModalContent안에다 안쓰면, 배경이 없어서 바깥 레이어에 있는 듯한 느낌이 있었습니다.
Content안에 넣으면 다음과 같이 나오긴 하지만, 사용할 때 조금 어색한 감이 있어서 말씀드려봤습니다!
제가 테스트 해봤던 코드는 다음과 같습니다.
'use client';
import { Modal, ModalContent, ModalFooter, ModalHandle, ModalHeader } from '@/components/ui/Modal/Modal';
import useAlert from '@/hooks/useAlert';
import { useRef } from 'react';
import LoginForm from '@/app/(auth)/login/_components/LoginForm';
import Button from '@/components/ui/Button/Button';
function Test() {
const alert = useAlert();
return <button onClick={() => alert('안녕')}>클릭</button>;
}
function TestForm() {
const modalRef = useRef<ModalHandle>(null);
return (
<>
<button onClick={() => modalRef.current?.open()}>폼 열기</button>
<Modal ref={modalRef}>
<div className='bg-white p-10'>
<LoginForm />
</div>
</Modal>
</>
);
}
function TestConfrim() {
const modalRef = useRef<ModalHandle>(null);
return (
<>
<button onClick={() => modalRef.current?.open()}>테스트 버튼</button>
<Modal ref={modalRef}>
<ModalHeader>
제목 <button onClick={() => modalRef.current?.close()}>닫기</button>
</ModalHeader>
<ModalContent>
<div>내용</div>
</ModalContent>
<ModalFooter>
<Button variant='outline'>취소</Button>
<Button>확인</Button>
</ModalFooter>
</Modal>
</>
);
}
export default function page() {
return (
<div className='flex flex-col'>
내 대시보드
<Test />
<TestForm />
<TestConfrim />
</div>
);
}
ToKyun02
approved these changes
Feb 7, 2025
SeokChan-Lee
approved these changes
Feb 7, 2025
rak517
approved these changes
Feb 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


❓이슈
✍️ Description
공용 모달 컴포넌트 작업했습니다.
base modal component 작업 (기본 베이스)
useAlert 훅을 통해 생성되는 알럿 모달 작업
페이지내에서 사용되는 공용 모달 컴포넌트 작업
추가전달
✅ Checklist
PR
Test
Additional Notes