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

♻️ [Refactor] 모달 추상화 #139

Merged
merged 15 commits into from
Jul 4, 2023
Merged

♻️ [Refactor] 모달 추상화 #139

merged 15 commits into from
Jul 4, 2023

Conversation

yoopark
Copy link
Contributor

@yoopark yoopark commented Jul 4, 2023

Summary

Material UI를 참고하여 모달을 추상화하였습니다.

  • Modal
  • Overlay
  • Dialog : Overlay + Center children
  • Drawer : Overlay + 상/하/좌/우에서 등장하는 children

Describe your changes

  • Dialog 사용 예시
export const EvalLogSearchDialog = ({
  form,
  onSubmit,
}: EvalLogSearchDialogProps) => {
  const { isOpen, onOpen, onClose } = useDisclosure();

  return (
    <>
      <EvalLogSearchAbsoluteButton onClick={onOpen} />
      <Dialog isOpen={isOpen} onClose={onClose}>
        <EvalLogSearchDialogView form={form} onSubmit={onSubmitWrapper} />
      </Dialog>
    </>
  );
};
  • Drawer 사용 예시
type TabletNavDrawerViewProps = {
  isOpen: boolean;
  onClose: () => void;
};

export const TabletNavDrawerView = ({
  isOpen,
  onClose,
}: TabletNavDrawerViewProps) => {
  return (
    <Drawer anchor="left" isOpen={isOpen} onClose={onClose}>
      <DesktopNavBar fixed={false} />
    </Drawer>
  );
};
  • Modal 사용 예시 (모바일에서 100% 전체를 먹는 모달은 Dialog가 아닌 모달이라고 네이밍하였습니다.)
type SearchModalProps = ModalType & {
  onClose: () => void;
};

export const SearchModal = ({ isOpen, onClose }: SearchModalProps) => {
  return (
    <Modal isOpen={isOpen}>
      <SearchModalView onClose={onClose} />
    </Modal>
  );
};

Issue number and link

@yoopark yoopark added the enhancement New feature or request label Jul 4, 2023
@yoopark yoopark self-assigned this Jul 4, 2023
@yoopark yoopark merged commit f3e5e5b into main Jul 4, 2023
@yoopark yoopark deleted the refactor/modal branch July 4, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Material UI 참고하여 Modal 및 하위 컴포넌트 추상화
1 participant