Skip to content

[Refactor] 공통 컴포넌트 리팩토링#43

Merged
dalzzy merged 25 commits intodevelopfrom
refactor/#29/공통-컴포넌트-리팩토링
Aug 2, 2025

Hidden character warning

The head ref may contain hidden characters: "refactor/#29/\uacf5\ud1b5-\ucef4\ud3ec\ub10c\ud2b8-\ub9ac\ud329\ud1a0\ub9c1"
Merged

[Refactor] 공통 컴포넌트 리팩토링#43
dalzzy merged 25 commits intodevelopfrom
refactor/#29/공통-컴포넌트-리팩토링

Conversation

@dalzzy
Copy link
Copy Markdown
Member

@dalzzy dalzzy commented Jul 31, 2025

🔍 관련된 이슈

📝 작업 내용

⚠️대공사를 해서 내용이 좀 많습니다,,

<공통 컴포넌트 리팩토링>

  1. Input : 간단한 스타일 수정
  2. Textarea 리팩토링
  • placeholderColorType prop 제거
  • required 시 * 표시 추가
  • showEmptyWarning / showMinLengthWarning 분리하여 메시지 중복 방지
  • validation 메시지는 동시에 하나만 보이도록 조건 분기 처리
  1. Header 리팩토링
  • leftSection, rightSection props로 레이아웃 제어
  • leftSection: 'BACK' | 'LOGO' | 'NONE' ( 순서대로 -> 뒤로가기 | 텍스트 로고 | 아무것도 x )
  • rightSection: 'SETTING' | 'DETAIL' | 'KEBAB' | 'NONE' ( 설정 | 리뷰 상세페이지 아이콘들 | 케밥버튼 아이콘 )
  • 타이틀은 children으로 전달.
  • BackButton, DetailButton 등은 별도 컴포넌트로 분리
  • BackButton: 기본 동작은 navigate(-1) / 필요 시 커스텀 onClick 가능
  • DetailButton: 하트 / 북마크 / 케밥 버튼 (리뷰 상세 페이지에서 사용 )
  • fixed 헤더를 사용해서 모든 하단 컨텐츠에 pt-[44px] 혹은 그 이상.. 값으로 겹침 방지
  1. 모달 리팩토링
  • 기존에는 Modal props까지 전역상태관리를 했었는데 modalType과 isOpen만 전역 상태로 관리하고,
    나머지 props는 모달을 사용하는 컴포넌트에서 직접 전달하도록 구조 변경
  • App.tsx에서 불필요해진 <Modal/> 코드 삭제
  • 사용 시 openModal('confirm') 이렇게 모달 타입을 지정한 후
      {modalType === 'confirm' && (
        <ConfirmModal
          title="후기를 등록하시겠어요?"
          subWarningText="탈퇴하면 7일 후 다시 가입할 수 있어요."
          subtitle="등록한 후기는 마이페이지에서 확인할 수 있어요."
          confirmText="등록하기"
          cancelText="취소"
        />
      )}

이런식으로 쓰면 됩니당

  • 모달의 기본 레이아웃( 배경색 흐리게, 위치 ) 은 BaseModal로 분리
  • 나머지는 BaseModal을 기반으로 구현
  • 기존의 모달 컴포넌트는 ConfirmModal로 분리했습니다!

<좌석 배치 모달 리팩토링 + 새 컴포넌트 추가>

  1. 좌석 관련 모달 타입을 SeatPicker | SeatFocus | SeatWrite로 분리
    → 좌석 배치 모달의 사용 목적(후기 조회, 리뷰 작성, 특정 좌석 위치 포커싱 등)에 따라 UI가 달라지기 때문에, SeatModal 컴포넌트에서 모달 타입에 따라 각각 다른 컴포넌트를 조건부 렌더링하도록 구현했습니다.
  2. SeatWrite 모달은 선택한 좌석아이디를 전역상태관리하도록 구현했습니다.

📸 스크린샷

2025-08-01.1.20.10.mov

Write 모달 열렸을 때 클릭 시 계속 좌석이 새로고침되는 건 목데이터가 계속 새로운 배열을 만들도록 되어 있어서 그렇습니당,,

image

Textarea 스타일 수정한 것

🚨 이슈

SeatFocus모달에서 해당하는 좌석의 위치로 포커싱이 되도록 했는데, 오른쪽에 위치한 좌석들은 잘 포커싱이 되는데 왼쪽에 있는 좌석들은 좌석이 표시가 안되는 이슈가 있습니다,,, (영상처럼 K21, K22 이렇게 오른쪽에 있는 좌석들은 잘 뜨는데 K05,K06 이런 좌석들은 표시가 안됨.. )

아마 수정할 부분이 더 있을텐데 우선 여기까지만 구현해놨습니당..

📣 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성

컴포넌트 리팩토링 후 해당 컴포넌트가 사용된 모든 페이지를 수정하다보니 변경 사항이 좀 많습니다..ㅜㅜ 죄송함니다
내용이 많긴한데 꼼꼼히 ,, 봐주세용..

그리고 제 PR이 머지되면 아마 충돌이 많이 발생할 것 같습니다,,, ㅜㅜ

현재 브랜치에서 해당 페이지를 수정하지 않았다면 모든 변경사항을 incoming 기준으로 병합해주시면 되고,

만약 수정한 부분이 있다면 헤더,모달,input,textarea 관련 코드만 incoming으로 수락해주시면 될 것 같아요..!

변경 범위가 꽤 많아 미리 양해의 말씀 드립니다 ,, 😭😭

✅ 체크리스트

  • 코드가 정상적으로 컴파일되나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?
  • 리뷰어를 지정했나요?

@dalzzy dalzzy requested review from sispo3314 and soyun-git121 July 31, 2025 16:31
@dalzzy dalzzy self-assigned this Jul 31, 2025
@dalzzy dalzzy added ♻️Refactor 코드 리팩토링 🎨Style 스타일 추가 및 수정 labels Jul 31, 2025
@dalzzy dalzzy linked an issue Jul 31, 2025 that may be closed by this pull request
4 tasks
@dalzzy dalzzy added the ✨Feature 새로운 기능 추가 label Jul 31, 2025
Copy link
Copy Markdown
Collaborator

@sispo3314 sispo3314 left a comment

Choose a reason for hiding this comment

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

변경사항 모두 확인했습니다!! 다른 컴포넌트들까지 수정하시느라 정말 고생하셨어요...
작업내용을 상세하게 적어주셔서 변경된 부분이 많아도 쉽게 파악할 수 있었습니다!! 수고하셨습니당 👏👏

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

하나하나 prop 지정하기 번거로웠는데 이렇게 컴포넌트로 묶으면 한번에 관리할 수 있겠네요!! 너무 좋은 것 같습니당 👏👏

Comment on lines +7 to +8
leftSection?: 'BACK' | 'LOGO' | 'NONE';
rightSection?: 'SETTING' | 'DETAIL' | 'KEBAB' | 'NONE';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

오 이렇게 묶으면 사용하기도 편하고 코드도 훨씬 간결해질 것 같아요! 🙌

@@ -47,7 +45,7 @@ export default function InputField({
'flex h-[48px] w-[335px] items-center rounded-lg border px-3',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

textarea에서 w-full을 디폴트로 받고 있어서 여기도 w-full로 수정하면 좋을 것 같아요!! 이건 그냥 제가 해도 됩니당

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

아항 이거때문에 /review/info 페이지에서 input 너비가 옹졸하게 보인 것이였군여,, 수정했슴니다!!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

여기 케이스별로 모달 분기 처리 깔끔하게 잘 해주신 것 같아요👍👍 타입에 따라서 각 모달이 명확히 분리되어 있어서 가독성도 좋고 추후 유지보수에도 좋을 것 같습니다

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

헤더 부분들 수정해주셔서 감사합니다ㅜㅜ!

Comment on lines +16 to +19
showEmptyWarning?: boolean;
showMinLengthWarning?: boolean;
required?: boolean;
className?: string;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

textarea컴포넌트 구현이 미흡했던거같은데 이런식으로 하면되군용..!

Comment on lines +22 to +24
<Header leftSection="BACK" rightSection="KEBAB">
의견 보내기
</Header>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

헤더 컴포넌트 수정해서 훨씬깔끔해진거같아용!

Copy link
Copy Markdown
Collaborator

@soyun-git121 soyun-git121 left a comment

Choose a reason for hiding this comment

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

나머지 부분도 코드 다 확인했습니당 작은부분까지 다 수정해주셔서 코드들이 훨씬깔끔해진거같아요! 변경사항많은데 수고하셨습니다ㅜㅜ 머지되면 잘 병합해보겠습니당!

@dalzzy dalzzy merged commit 2f86b57 into develop Aug 2, 2025
1 check passed
@dalzzy dalzzy deleted the refactor/#29/공통-컴포넌트-리팩토링 branch August 8, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feature 새로운 기능 추가 ♻️Refactor 코드 리팩토링 🎨Style 스타일 추가 및 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] #29 공통 컴포넌트 + 좌석 배치 모달 리팩토링

3 participants