Skip to content
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

[Feat] DefaultDialog 컴포넌트 추가 #83

Merged
merged 7 commits into from
Dec 18, 2023
Merged

[Feat] DefaultDialog 컴포넌트 추가 #83

merged 7 commits into from
Dec 18, 2023

Conversation

wade3420
Copy link
Collaborator

@wade3420 wade3420 commented Dec 14, 2023

🤔 해결하려는 문제가 무엇인가요?

closed #76

🎉 변경 사항

  • Portal 컴포넌트
  • AnimatePortal 컴포넌트
  • Modal 컴포넌트에서 padding props로 수정할 수 있게 한다 (이건 맞는 방법인지 확신없음)
  • Modal 컴포넌트 에서 AnimatePortal 로 애니매이션을 사용해서 나타나고 사라진다.
  • Dialog 컴포넌트는 default , list, select 가 있지만 우선 default 만 구현
  • DefaultDialog

🙏 여기는 꼭 봐주세요!

  • DefaultDialog 에서 확인 버튼과 취소버튼을 받는 방법에 대한 고민
    현재는 버튼 text와 click 핸들러를 각각 받아서 컴포넌트 안에서 실행시켜주는 방식 (확장성 낮다, 디자인가이드에 나와있는 대로 구현)
    다른 방법을 고려중인 것은 확인 버튼과 취소 버튼을 element props로 받아서 랜더링 시켜주는 방식. (확장성 높지만 디자인가이드에 100% 나와있는 대로는 아니다)

버튼 컴포넌트를 props로 주입시 스토리북에서는 어떻게 보이면 좋을지도 궁금합니다.

사용 방법

  • 스토리북과 주석 참고

🌄 스크린

스크린샷 2023-12-15 오전 4 32 15

📚 참고

https://github.com/depromeet/na-lab-client/blob/main/src/components/portal/AnimatePortal.tsx
https://www.framer.com/motion/animate-presence/

Copy link

vercel bot commented Dec 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
10mm-client-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2023 6:09am

Copy link
Contributor

Copy link
Member

@sumi-0011 sumi-0011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니당!

inline에 있는 스타일을 어떻게 하면 좋을까요 🤔

Comment on lines 44 to 47
className={css({
textStyle: 'title3',
color: 'text.primary',
})}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분 처럼 inline으로 스타일이 들어가 있는 부분은 밑으로 빼는게 어떨까요?! (위의 코드와 통일하기)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 inline스타일들은 밑으로 빼겠습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

35e69a6 여기서 수정해주었어요

Comment on lines 77 to 81
{confirmText && (
<Button size={'medium'} variant={'ghost'} onClick={handleConfirm}>
{confirmText}
</Button>
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

피그마를 확인해보니 취소버튼이 없는 경우는 있어도 확인 버튼은 모두 있는것으로 보입니다!
디자이너가 전달해준 디자인 시스템을 그대로 따라갈 것이라면, confirmText props는 필수로 하는게 좋을 것 같아요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e31dca0 여기서 수정해주었어요

Comment on lines +7 to +27
const DialogStory = (arg: Pick<DefaultDialogProps, 'title' | 'content' | 'cancelText' | 'confirmText'>) => {
const { isOpen, openModal, closeModal } = useModal();
return (
<div>
<Button size={'large'} variant={'cta'} onClick={openModal}>
Open Dialog
</Button>
<Dialog variant={'default'} isOpen={isOpen} onClose={closeModal} {...arg} />
</div>
);
};

const meta = {
title: 'Component/Dialog',
component: DialogStory,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
} satisfies Meta<typeof DialogStory>;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아니 이거 이런식으로 하는거군여, 이제야 깨달음 😱

Comment on lines 34 to 35
}
export type DialogProps = DefaultDialogProps | ListDialogProps | SelectDialogProps;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

진짜 사소한거지만 여기도 한칸 enter 치면 좋을 것 같아요.
이거 강제하는 eslint 설정이 있었던 것 같은데 찾아보겠습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ee1073a 여기서 적용해주었습니다

Comment on lines +16 to +20
className={css({
textStyle: 'title3',
color: 'text.primary',
})}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스토리 스타일도 밑으로 분리하는게 좋을까요?

가독성에는 좋을 것 같긴 하지만 조금 번거롭다는 단점이 있을 것 같네요..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스토리의 스타일은 그대로 두겠습니다. 저도 스토리에서는 조금 번거로울것같아요

Comment on lines +8 to +27
/**
* @description ref를 제외한 영역을 클릭했을 때 실행되는 hook 입니다.
* @param ref
* @param handler 클릭 이벤트가 발생했을 때 실행되는 함수입니다.
*/
function useOutsideClick({ ref, handler }: UseOutsideClickProps) {
useEffect(() => {
const listener = (event: MouseEvent) => {
if (!ref.current || ref.current.contains(event.target as Node)) {
return;
}
handler(event);
};

document.addEventListener('mousedown', listener);
return () => {
document.removeEventListener('mousedown', listener);
};
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@wade3420 wade3420 merged commit aa806a7 into develop Dec 18, 2023
3 checks passed
@wade3420 wade3420 deleted the feat/dialog branch December 18, 2023 08:03
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] 다이얼로그 컴포넌트 구현
2 participants