-
Notifications
You must be signed in to change notification settings - Fork 3
Kibeom/1week teamcard #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- CSS reset - tailwind spacing에 "pxr" suffix 추가 - screen 사이즈 조정 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- TeamMemberCard 컴포넌트 구현 - lucide-react 라이브러리 설치 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- Modal 컴포넌트 구현 - TeamMemberCard 컴포넌트에 Modal 컴포넌트 적용 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- 조건부 tailwind uc 처리 - 중복 tailwind uc 제거 Signed-off-by: kibum.lee <kissyou7@gmail.com>
Signed-off-by: kibum.lee <kissyou7@gmail.com>
- onOpenChange, open prop을 사용하여 외부에서 상태 관리 가능하도록함 - ModalClose 추가 하여, Close 커스텀 가능하도록함 - aria 속성 추가 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- Card 컴포넌트는 공통 적용부분만 분리 - TeamMemberCard의 모달 state 직접관리 - 기타 코드 정리 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- mount, visible 상태 추가 Signed-off-by: kibum.lee(t14) <kissyou7@gmail.com>
| const { visible, closeModal } = useModalContext(); | ||
|
|
||
| useEffect(() => { | ||
| const handleEsc = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 하면 모든 domtree에 Modal 이 활성화 되어있을경우에 esc 이벤트가 다 closeModal로 되었던 경험이 있어서
useRef()로 사용해서 해당 node에 event 걸면 어떨까요??
| const isOpen = open ? open : _open; | ||
|
|
||
| const openModal = useCallback(() => { | ||
| onOpenChange && onOpenChange(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재는 context provider를 사용하고 있으신데 onOpenChange,setOpen을 하나로 통합 할 수 있을거같은데 제가 contextValue는 사용해보지 않아서 ㅠㅠ 혹시 방법이 없을까욤
제 경우,
전역상태라이브러리 관리를 썼을경우에는 부모 컴포넌트에서 전역상태를 수정하면 자식에서도 수정되는 형식으로
const Modal = ({ children }: Props) => {
const { toggleModal } = useModalStore();
return (
<div>
<div className={styles['modal-overlay']} onClick={toggleModal}></div>
<div className={styles['modal-content-container']}>
<div className={styles['modal-content']}>
<h1>모달테스트</h1>
{children}
<button
onClick={toggleModal}
className={styles['modal-close-button']}
type='button'
>
닫기
</button>
</div>
</div>
</div>
);
};
export default Modal;
이런식으로
useModalStore 상태를 바꿔줬던것 같습니다. !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- mount, open의 역할이 궁금합니다!
- mount 상태에 따른 content 렌더링 버그 수정 - ModalTrigger 버그수정 Signed-off-by: kibum.lee <kissyou7@gmail.com>
- ModalClose 존재하지 않는경우 Default 스타일로 ModalClose 스타일 적용 Signed-off-by: kibum.lee <kissyou7@gmail.com>
1주차 과제 - TeamMemberCard 만들기
개요
팀원들의 카드리스트를 만들고 클릭시 상세 정보를 보여준다.
구현 내용
1. 기본과제
2. 선택과제
3. 기타
tailwind spacing UC(utilitycase) extend
p-20pxr⇒1.25rem으로 자동 적용cn util ( tailwind-merge, clsx 사용)
추가 Library
주요 학습내용
1. radix ui 스타일의 컴포넌트 구현
2. 사용 기술
createContext,useContext)openModal,closeModal,open)를 하위 컴포넌트에 공유하기 위해 사용createPortal)document.body에 렌더링하여 레이어 분리, z-index 문제 방지.Children,isValidElement)children을 검사 및 조건 분기 처리UI/UX 특징
1. 반응형