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

마이페이지 레이아웃 수정 건 #219

Merged
merged 5 commits into from
Oct 30, 2024
Merged

Conversation

sumi-0011
Copy link
Member

@sumi-0011 sumi-0011 commented Oct 29, 2024

💡 기능

기존에는 하드코딩으로 레이아웃 최대 높이를 지정했어요. (css calc 사용 등)
모두 다 하드코딩으로 하다보니, 예측하기가 너무 어려워 졌다고 생각하였고, 레이아웃을 전체적으로 수정할 필요성을 느끼게 되었습니다.

🔎 기타

Summary by CodeRabbit

  • 새로운 기능
    • FarmTypeOneType 컴포넌트의 구조와 스타일이 개선되어 사용자 경험이 향상되었습니다.
  • 버그 수정
    • 레이아웃 및 반응형 디자인 개선으로 다양한 화면 크기에서의 사용성이 향상되었습니다.
  • 문서화
    • 컴포넌트의 스타일과 구조가 명확해져 유지보수성이 높아졌습니다.

Copy link

coderabbitai bot commented Oct 29, 2024

Walkthrough

이 풀 리퀘스트에서는 FarmType, OneType, Mypage, 및 MypageLayout 컴포넌트의 구조와 스타일에 대한 여러 가지 수정이 이루어졌습니다. 주요 변경 사항으로는 JSX 구조의 전환, 스타일 클래스의 통합 및 조건부 렌더링 방식의 조정이 포함됩니다. 이러한 변경은 컴포넌트의 가독성과 유지 관리성을 향상시키고, 레이아웃의 일관성을 높이기 위한 것입니다.

Changes

파일 경로 변경 요약
apps/web/src/app/[locale]/mypage/(github-custom)/FarmType.tsx - FarmType 함수 선언을 내보내기 함수로 변경
- JSX 구조를 div로 변경 및 재구성
- 스타일 조정
apps/web/src/app/[locale]/mypage/(github-custom)/OneType.tsx - 메인 컨테이너를 <section>에서 <div>로 변경
- 조건부 클래스 적용 방식 수정
- 스타일 통합
apps/web/src/app/[locale]/mypage/(github-custom)/page.tsx - 임포트 문서 재정렬
- JSX 구조를 React fragment로 변경
- 새로운 클래스 이름 tabItemStyle 추가
apps/web/src/app/[locale]/mypage/layout.tsx - 반환 구조를 div로 변경
- 스타일 변수 재정의 및 추가
- 배경 이미지 제거

Possibly related PRs

  • refactor: mypage layout 분리 #203: FarmTypeOneType 컴포넌트의 변경 사항이 mypage 레이아웃의 수정과 관련이 있으며, 두 변경 모두 사용자 상호작용에 따라 섹션을 조건부로 렌더링하는 방식에 대한 구조 조정을 포함합니다.

Suggested labels

diff: XL, area: UI

Suggested reviewers

  • hyesungoh

Poem

🐰 변화의 바람이 불어와,
농장의 모습이 새로워,
선택의 기쁨이 넘치고,
레이아웃이 더욱 빛나네.
함께하는 이 순간,
우리 모두의 행복한 꿈! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sumi-0011 sumi-0011 self-assigned this Oct 30, 2024
# Conflicts:
#	apps/web/src/app/[locale]/mypage/(github-custom)/FarmType.tsx
@sumi-0011 sumi-0011 marked this pull request as ready for review October 30, 2024 02:32
@sumi-0011 sumi-0011 requested a review from hyesungoh as a code owner October 30, 2024 02:32
@sumi-0011 sumi-0011 changed the title 마이페이지 레이아웃 수정 건/WIP 마이페이지 레이아웃 수정 건 Oct 30, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
apps/web/src/app/[locale]/mypage/layout.tsx (1)

Line range hint 65-77: 사용되지 않는 bgStyle을 제거해주세요.

Image 컴포넌트가 제거되었으므로, bgStyle은 더 이상 사용되지 않는 것으로 보입니다.

다음 코드를 제거해주세요:

- const bgStyle = css({
-   position: 'absolute',
-   top: 0,
-   left: 0,
-   width: '100%',
-   height: 'calc(100% - 86px)',
-   zIndex: 0,
-   objectFit: 'cover',
-   marginTop: '86px',
-   pointerEvents: 'none',
- });

또한 하드코딩된 배경색상 #019C5A를 디자인 시스템의 색상 변수로 교체하는 것을 고려해보세요.

apps/web/src/app/[locale]/mypage/(github-custom)/page.tsx (1)

42-45: 레이아웃 계산 방식이 개선되었습니다.

하드코딩된 높이값 대신 flex와 overflow 속성을 사용하여 레이아웃을 처리한 것이 더 유연한 해결책입니다. 다만 다음 사항들을 고려해보시면 좋겠습니다:

  1. 모바일 환경에서의 동작 검증
  2. 내용이 넘칠 때의 사용자 경험

필요한 경우 다음과 같이 모바일 대응을 추가할 수 있습니다:

 const tabItemStyle = css({
   flex: 1,
   overflow: 'hidden',
+  _mobile: {
+    minHeight: 0,
+    overflow: 'auto'
+  }
 });
apps/web/src/app/[locale]/mypage/(github-custom)/FarmType.tsx (2)

79-105: 레이아웃 구조가 개선되었습니다만, 접근성 개선이 필요합니다.

레이아웃이 더 체계적으로 구성되었으나, 다음 사항들을 고려해주세요:

  1. Button 컴포넌트에 aria-label 속성 추가가 필요합니다
  2. GitanimalsFarm 컴포넌트에 대한 대체 텍스트나 aria-label이 필요할 수 있습니다

다음과 같이 수정을 제안드립니다:

-        <Button className="extend-button" onClick={() => setIsExtend((prev) => !prev)}>
+        <Button 
+          className="extend-button" 
+          onClick={() => setIsExtend((prev) => !prev)}
+          aria-label={isExtend ? t('shrink-button') : t('extend-button')}
+        >

109-131: 스타일 구현이 PR 목표와 잘 부합됩니다.

  1. flexGrowSectionStyle의 구현으로 하드코딩된 높이값 대신 유연한 레이아웃을 제공합니다
  2. 모바일 대응이 적절히 구현되었습니다
  3. overflow 처리가 적절히 구현되어 있습니다

하나의 제안사항이 있습니다:

성능 최적화를 위해 미디어 쿼리 스타일을 다음과 같이 분리하는 것을 고려해보세요:

const mobileFarmSectionStyle = css({
  background: 'none',
  maxHeight: 'auto',
  height: 'auto',
  overflowY: 'auto',
  borderRadius: 0,
});

const farmSectionStyle = css({
  display: 'flex',
  flexDirection: 'column',
  width: '100%',
  maxHeight: '100%',
  py: 40,
  gap: 24,
  
  _mobile: mobileFarmSectionStyle
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4bea62a and 87ad950.

📒 Files selected for processing (4)
  • apps/web/src/app/[locale]/mypage/(github-custom)/FarmType.tsx (3 hunks)
  • apps/web/src/app/[locale]/mypage/(github-custom)/OneType.tsx (1 hunks)
  • apps/web/src/app/[locale]/mypage/(github-custom)/page.tsx (3 hunks)
  • apps/web/src/app/[locale]/mypage/layout.tsx (1 hunks)
🔇 Additional comments (6)
apps/web/src/app/[locale]/mypage/layout.tsx (1)

23-40: 태블릿 지원을 위한 중간 브레이크포인트 추가가 필요합니다.

TODO 주석에서 언급된 태블릿 대응이 아직 구현되지 않았습니다. 현재는 데스크톱과 모바일만 지원되고 있어 태블릿 사용자 경험이 최적화되지 않을 수 있습니다.

태블릿 지원을 위한 브레이크포인트를 추가하시겠습니까? 다음과 같은 미디어 쿼리를 제안드립니다:

  '@media (max-width: 1400px)': {
    margin: '120px 100px 0',
  },
+ '@media (max-width: 1024px)': {
+   margin: '120px 60px 0',
+   gridTemplateColumns: '180px 1fr',
+   gap: 40,
+ },
apps/web/src/app/[locale]/mypage/(github-custom)/page.tsx (2)

1-5: 임포트 구문이 잘 정리되었습니다.

임포트 구문이 논리적인 순서로 잘 정리되어 있으며, FarmType을 named import로 변경한 것이 타입스크립트의 모범 사례를 따르고 있습니다.


Line range hint 27-37: 불필요한 DOM 중첩이 제거되었습니다.

Fragment를 사용하여 불필요한 div 래퍼를 제거한 것이 좋은 변경사항입니다. 하지만 탭 컨텐츠의 레이아웃 동작을 더 명확하게 이해하기 위해 몇 가지 확인이 필요합니다.

탭 컨텐츠의 레이아웃 동작을 확인하기 위해 관련 컴포넌트들을 검사하겠습니다:

✅ Verification successful

레이아웃 동작이 적절하게 구현되어 있음을 확인했습니다.

코드 검사 결과, OneType과 FarmType 컴포넌트 모두 적절한 레이아웃 처리가 되어 있습니다:

  • 두 컴포넌트 모두 flexGrowSectionStyle을 통해 동적 크기 조절 지원
  • overflow: auto를 통한 스크롤 처리
  • 컨텐츠에 따른 유연한 레이아웃을 위한 flex 속성 사용

Fragment로의 변경과 함께 이러한 레이아웃 처리는 UI의 일관성과 사용성을 향상시킬 것으로 보입니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# FarmType과 OneType 컴포넌트의 레이아웃 관련 코드 검사
rg -t tsx "height|overflow|flex" --glob "FarmType.tsx" --glob "OneType.tsx"

Length of output: 101


Script:

#!/bin/bash
# Search for layout-related styles in all TypeScript/JavaScript files
rg -t ts -t js "height|overflow|flex" --glob "**/FarmType*" --glob "**/OneType*"

# Search for style definitions in CSS/SCSS files
rg -t css -t scss "height|overflow|flex" --glob "**/mypage/**"

# Find the actual component files to verify their existence and location
fd -t f "FarmType|OneType" --glob "**/*.{tsx,ts,js,jsx}"

Length of output: 4100

apps/web/src/app/[locale]/mypage/(github-custom)/FarmType.tsx (1)

9-9: 내보내기 선언이 적절하게 추가되었습니다.

컴포넌트의 내보내기 선언과 import 구문이 잘 정리되었습니다.

Also applies to: 21-21

apps/web/src/app/[locale]/mypage/(github-custom)/OneType.tsx (2)

44-71: 컴포넌트 구조 개선이 잘 이루어졌습니다!

컨테이너 구조를 <div>로 변경하고 섹션을 명확하게 분리한 것이 레이아웃 관리에 더 효과적입니다. 특히 isExtend 상태에 따른 조건부 클래스 적용 방식이 이전의 하드코딩된 방식보다 훨씬 유연합니다.


75-87: 모바일 접근성 개선이 필요합니다.

스타일 구조는 전반적으로 개선되었지만, 모바일에서 배경을 제거하는 것이 사용자 경험에 영향을 줄 수 있습니다. 콘텐츠의 가시성과 대비를 확인해주세요.

Comment on lines +11 to +17
<div className={containerStyle}>
<GNB />
<div className={mainStyle}>
<ProfileSection />
<div className={rightSectionStyle}>{children}</div>
</div>
</>
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

시맨틱 HTML 요소 사용을 고려해보세요.

현재 일반 div 요소를 사용하고 있지만, 페이지의 구조를 더 명확하게 표현하기 위해 시맨틱 요소를 사용하는 것이 좋습니다.

다음과 같이 수정해보세요:

-    <div className={containerStyle}>
+    <main className={containerStyle}>
       <GNB />
-      <div className={mainStyle}>
+      <section className={mainStyle}>
         <ProfileSection />
-        <div className={rightSectionStyle}>{children}</div>
+        <section className={rightSectionStyle}>{children}</section>
-      </div>
+      </section>
-    </div>
+    </main>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className={containerStyle}>
<GNB />
<div className={mainStyle}>
<ProfileSection />
<div className={rightSectionStyle}>{children}</div>
</div>
</>
</div>
<main className={containerStyle}>
<GNB />
<section className={mainStyle}>
<ProfileSection />
<section className={rightSectionStyle}>{children}</section>
</section>
</main>

Comment on lines +43 to +53
height: 'calc(100vh - 240px)',
overflow: 'hidden',
width: '100%',
maxW: '1080px',
borderRadius: 16,
background: 'white.white_10',
backdropFilter: 'blur(7px)',
minHeight: '700px',
height: 'calc(100vh - 240px)',
maxHeight: 'min(calc(100vh - 240px), 1000px)',
overflow: 'hidden',
maxHeight: '1400px',
p: 40,
display: 'flex',
flexDirection: 'column',

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

하드코딩된 maxHeight 값을 제거해야 합니다.

PR의 목적이 하드코딩된 값을 제거하는 것이었으나, maxHeight: '1400px'가 여전히 하드코딩되어 있습니다. 이는 다양한 화면 크기에서 예측하기 어려운 레이아웃 동작을 유발할 수 있습니다.

다음과 같이 수정하는 것을 제안드립니다:

- maxHeight: '1400px',
+ maxHeight: 'calc(100vh - 120px)',

또한 heightmaxHeight 계산식이 서로 다른 값을 사용하고 있습니다:

  • height: calc(100vh - 240px)
  • 제안된 maxHeight: calc(100vh - 120px)

이 차이가 의도된 것인지 확인해주시기 바랍니다.

Committable suggestion was skipped due to low confidence.

Comment on lines +91 to +97
const flexGrowSectionStyle = css({
flex: '1',
minHeight: '0',
overflow: 'auto',
display: 'flex',
flexWrap: 'wrap',
});
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

스타일 최적화를 제안드립니다.

flexGrowSectionStyle의 구현이 레이아웃 문제를 잘 해결했습니다. 성능 최적화를 위해 다음과 같은 변경을 고려해보세요:

 const flexGrowSectionStyle = css({
   flex: '1',
   minHeight: '0',
   overflow: 'auto',
   display: 'flex',
   flexWrap: 'wrap',
+  willChange: 'flex-basis',
 });

이 변경은 flex 애니메이션 성능을 향상시킬 수 있습니다.

Committable suggestion was skipped due to low confidence.

Copy link
Member

@hyesungoh hyesungoh left a comment

Choose a reason for hiding this comment

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

개선은 언제나 환영이라고 ~~ 👍

@sumi-0011 sumi-0011 merged commit ff00586 into main Oct 30, 2024
10 checks passed
@sumi-0011 sumi-0011 deleted the refactor/mypage-layout-re branch October 30, 2024 05:16
@coderabbitai coderabbitai bot mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants