Skip to content

Conversation

@keemsebin
Copy link
Member

@keemsebin keemsebin commented Dec 9, 2024

관련 이슈

close #84

📑 작업 내용

  • swiper 라이브러리 설치 후 캐러셀 구현하였습니다.
2024-12-09.11.53.32.mov

💬 리뷰 중점 사항/기타 참고 사항

  • 조금 밋밋해보이기도 해서, UI 관련 스타일링 피드백 환영합니다~!

Summary by CodeRabbit

  • 새로운 기능

    • 이미지 캐러셀을 포함한 Landing 컴포넌트 추가.
    • 새로운 라우트 설정으로 Landing 컴포넌트를 기본 뷰로 지정.
    • Swiper 라이브러리 의존성 추가.
  • 문서화

    • swiperOptions.ts 파일에 Swiper 구성 옵션 추가.

@keemsebin keemsebin added the feat 기능 label Dec 9, 2024
@keemsebin keemsebin self-assigned this Dec 9, 2024
@keemsebin keemsebin requested a review from houony as a code owner December 9, 2024 14:58
@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2024

Walkthrough

이 변경 사항은 findy-fe 프로젝트의 package.json 파일에 새로운 의존성인 "swiper": "^11.1.15"를 추가하는 것을 포함합니다. 또한, 새로운 파일 swiperOptions.ts가 생성되어 Swiper 라이브러리의 설정을 관리하는 swiperOptions 상수를 내보냅니다. Landing.tsx 파일에서는 Swiper를 사용하여 이미지 캐러셀을 생성하는 새로운 React 컴포넌트가 추가되었으며, route.tsx 파일에서는 이 컴포넌트를 기본 경로에 대한 라우트로 설정하고 있습니다.

Changes

파일 경로 변경 요약
package.json 새로운 의존성 "swiper": "^11.1.15" 추가
src/constants/swiperOptions.ts swiperOptions 상수를 내보내는 새로운 파일 생성
src/pages/Landing.tsx Swiper를 사용하여 이미지 캐러셀을 생성하는 Landing 컴포넌트 추가
src/routes/route.tsx Landing 컴포넌트를 기본 경로에 대한 라우트로 설정

Assessment against linked issues

Objective Addressed Explanation
랜딩 페이지 UI 구현 (#84)

Possibly related PRs

  • [FEAT] NaverMap API 연결, 컴포넌트 구현 #23: Swiper 라이브러리를 추가하는 주요 PR로, UI 향상을 위한 새로운 기능을 통합하는 다른 컴포넌트를 도입하고 있습니다.
  • [FEAT] SideMenu 연결 #38: Landing 컴포넌트와 관련된 UI 요소를 수정하는 PR로, 두 컴포넌트 모두 사용자 인터페이스와 내비게이션과 연관이 있습니다.

Suggested reviewers

  • houony

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.

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: 2

🧹 Outside diff range and nitpick comments (4)
src/constants/swiperOptions.ts (2)

11-13: 자동 재생 시간을 조정하는 것이 좋습니다.

현재 3초(3000ms)로 설정된 자동 재생 시간은 사용자가 콘텐츠를 충분히 읽기에는 다소 짧을 수 있습니다. 사용자 경험 향상을 위해 5초(5000ms) 정도로 늘리는 것을 고려해보세요.

  autoplay: {
-   delay: 3000,
+   delay: 5000,
  },

3-18: 타입 안전성을 개선하면 좋겠습니다.

swiperOptions 객체에 대한 명시적인 타입 정의를 추가하면 유지보수성이 향상될 것 같습니다.

+ import { SwiperOptions } from 'swiper/types';
+ 
- export const swiperOptions = {
+ export const swiperOptions: SwiperOptions = {
src/routes/route.tsx (1)

4-4: import 순서를 수정해주세요.

eslint 규칙에 따라 import 문의 순서를 조정해야 합니다. @/ 경로의 import를 먼저 선언해주세요.

import { createBrowserRouter } from 'react-router-dom';

import { App } from '@/App';
- import { Landing } from '@/pages/Landing';
import { Link } from '@/pages/Link';
import { MapView } from '@/pages/MapView';
+ import { Landing } from '@/pages/Landing';
src/pages/Landing.tsx (1)

11-11: 이미지 배열을 상수로 분리하고 타입을 정의해주세요.

하드코딩된 이미지 배열을 별도의 상수 파일로 분리하고, 적절한 타입을 정의하면 유지보수성이 향상될 것 같습니다.

- const img = ['current', 'extract', 'maker', 'makers', 'youtube'];
+ // src/constants/images.ts
+ export const LANDING_IMAGES = ['current', 'extract', 'maker', 'makers', 'youtube'] as const;
+ export type LandingImage = typeof LANDING_IMAGES[number];
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d5becc8 and 570d0a4.

⛔ Files ignored due to path filters (8)
  • .yarn/cache/swiper-npm-11.1.15-30ca9116f5-3faabc5b33.zip is excluded by !**/.yarn/**, !**/*.zip
  • .yarn/install-state.gz is excluded by !**/.yarn/**, !**/*.gz
  • public/landing/current.png is excluded by !**/*.png
  • public/landing/extract.png is excluded by !**/*.png
  • public/landing/maker.png is excluded by !**/*.png
  • public/landing/makers.png is excluded by !**/*.png
  • public/landing/youtube.png is excluded by !**/*.png
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/constants/swiperOptions.ts (1 hunks)
  • src/pages/Landing.tsx (1 hunks)
  • src/routes/route.tsx (2 hunks)
🧰 Additional context used
🪛 eslint
src/pages/Landing.tsx

[error] 1-1: react-router-dom import should occur after import of @/constants/swiperOptions

(import/order)

🔇 Additional comments (2)
package.json (2)

Line range hint 1-89: 전반적인 package.json 구조가 잘 구성되어 있습니다

의존성들이 잘 구성되어 있고, 개발 도구들도 적절하게 설정되어 있습니다.


40-40: Swiper 라이브러리 의존성 추가 검토 필요

다음 사항들을 고려해주시기 바랍니다:

  1. 버전 고정을 위해 ^11.1.15 대신 11.1.15로 변경하는 것이 안정성 측면에서 좋을 것 같습니다.
  2. 번들 사이즈 최적화를 위해 필요한 모듈만 import하는 것을 권장드립니다.
✅ Verification successful

Let me check how Swiper is being imported in the codebase to verify the bundle size impact concern.


Swiper 의존성 관련 검토 결과

분석 결과 다음과 같은 사항들이 확인되었습니다:

  1. 현재 코드베이스에서는 필요한 모듈만 선택적으로 import하고 있어 번들 사이즈 최적화가 잘 되어있습니다:

    • swiper/react에서 핵심 컴포넌트만 import
    • swiper/modules에서 필요한 기능(Pagination, Navigation, Autoplay)만 import
  2. 보안 취약점 검사 결과, 현재 사용 중인 버전 11.1.15는 안전합니다. (발견된 취약점은 6.5.1 이전 버전에만 해당)

  3. 버전 고정(^ 제거)에 대한 초기 제안은 유효하나, Swiper의 안정적인 업데이트 기록을 고려할 때 선택사항으로 조정합니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Swiper package size and security

# Check bundle size impact
curl -s https://bundlephobia.com/api/size?package=swiper@11.1.15 | jq '{
  size: .size,
  gzippedSize: .gzipSize,
  dependencyCount: .dependencyCount
}'

# Check for known vulnerabilities
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "swiper") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Length of output: 758


Script:

#!/bin/bash
# Search for Swiper imports in the codebase
rg "from ['|\"]swiper" -A 2

# Search for Swiper CSS imports
rg "@import.*swiper"

Length of output: 389

Comment on lines +30 to +34
<div className="absolute bottom-3 w-full max-w-[30rem] px-4 mb-5">
<Button variant="primary" size="large" onClick={() => navigate('/map')}>
시작하기
</Button>
</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

버튼의 위치 지정 방식을 개선해주세요.

현재 absolute 포지셔닝을 사용하고 있는데, 이는 다양한 화면 크기에서 문제를 일으킬 수 있습니다. Flexbox를 활용한 레이아웃으로 변경하는 것이 좋겠습니다.

- <div className="absolute bottom-3 w-full max-w-[30rem] px-4 mb-5">
+ <div className="w-full max-w-[30rem] px-4 mb-5 mt-auto">

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 23 to 27
{img.map((item, index) => (
<SwiperSlide key={index} className="flex justify-center items-center ">
<img src={`/landing/${item}.png`} className="w-full h-full object-cover" />
</SwiperSlide>
))}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

접근성과 성능 개선이 필요합니다.

  1. 이미지에 alt 텍스트가 없어 스크린 리더 사용자의 접근성이 떨어집니다.
  2. 배열의 인덱스를 key로 사용하는 것은 권장되지 않습니다.
  3. 이미지 로딩 최적화를 위해 lazy loading을 적용하면 좋겠습니다.
- {img.map((item, index) => (
+ {LANDING_IMAGES.map((item) => (
-   <SwiperSlide key={index} className="flex justify-center items-center ">
+   <SwiperSlide key={item} className="flex justify-center items-center">
-     <img src={`/landing/${item}.png`} className="w-full h-full object-cover" />
+     <img 
+       src={`/landing/${item}.png`}
+       alt={`${item} 설명 이미지`}
+       loading="lazy"
+       className="w-full h-full object-cover"
+     />
    </SwiperSlide>
  ))}
📝 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
{img.map((item, index) => (
<SwiperSlide key={index} className="flex justify-center items-center ">
<img src={`/landing/${item}.png`} className="w-full h-full object-cover" />
</SwiperSlide>
))}
{LANDING_IMAGES.map((item) => (
<SwiperSlide key={item} className="flex justify-center items-center">
<img
src={`/landing/${item}.png`}
alt={`${item} 설명 이미지`}
loading="lazy"
className="w-full h-full object-cover"
/>
</SwiperSlide>
))}

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: 0

🧹 Outside diff range and nitpick comments (3)
src/pages/Landing.tsx (3)

1-10: 임포트 순서를 개선해주세요

코드의 일관성을 위해 임포트 순서를 다음과 같이 정리하는 것이 좋습니다:

  1. 외부 라이브러리 (react-router-dom, swiper)
  2. 스타일 (swiper/css)
  3. 내부 컴포넌트 (@/components/*)
  4. 상수 (@/constants/*)
+ import { Swiper, SwiperSlide } from 'swiper/react';
+ import { useNavigate } from 'react-router-dom';
+
+ import 'swiper/css';
+ import 'swiper/css/pagination';
+
+ import { Button } from '@/components/common/Button';
+ import { Icon } from '@/components/common/Icon';
+ import { Body1 } from '@/components/common/Typography';
+
+ import { swiperOptions } from '@/constants/swiperOptions';
- import { useNavigate } from 'react-router-dom';
- import { Swiper, SwiperSlide } from 'swiper/react';
-
- import 'swiper/css';
- import 'swiper/css/pagination';
- import { Button } from '@/components/common/Button';
- import { Icon } from '@/components/common/Icon';
- import { Body1 } from '@/components/common/Typography';
- import { swiperOptions } from '@/constants/swiperOptions';
🧰 Tools
🪛 eslint

[error] 1-1: react-router-dom import should occur after import of @/constants/swiperOptions

(import/order)


11-12: 상수에 대한 문서화가 필요합니다

LANDING_IMAGES 배열의 각 이미지가 어떤 내용을 나타내는지 주석으로 설명해주세요. 또한 이미지 파일명을 더 명확하게 지정하면 좋겠습니다.

+ // 랜딩 페이지 캐러셀에 표시될 이미지 목록
+ // current: 현재 위치 화면
+ // extract: 정보 추출 화면
+ // maker: 제작자 정보
+ // makers: 제작자 목록
+ // youtube: 유튜브 연동 화면
const LANDING_IMAGES = ['current', 'extract', 'maker', 'makers', 'youtube'];

17-21: 반응형 디자인 개선이 필요합니다

현재 고정된 마진과 크기 값들이 모든 화면 크기에서 최적의 레이아웃을 보장하지 않을 수 있습니다. Tailwind의 반응형 클래스를 활용하여 개선해보세요.

- <div className="flex flex-col items-center justify-center gap-5 mt-32">
+ <div className="flex flex-col items-center justify-center gap-5 mt-16 md:mt-24 lg:mt-32">
-   <Icon name="findyLogo1" className="w-2/3 h-20" />
+   <Icon name="findyLogo1" className="w-2/3 h-16 md:h-20" />
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 570d0a4 and 5781392.

📒 Files selected for processing (1)
  • src/pages/Landing.tsx (1 hunks)
🧰 Additional context used
🪛 eslint
src/pages/Landing.tsx

[error] 1-1: react-router-dom import should occur after import of @/constants/swiperOptions

(import/order)

🔇 Additional comments (2)
src/pages/Landing.tsx (2)

35-39: 버튼의 위치 지정 방식을 개선해주세요

현재 absolute 포지셔닝을 사용하고 있는데, 이는 다양한 화면 크기에서 문제를 일으킬 수 있습니다. Flexbox를 활용한 레이아웃으로 변경하는 것이 좋겠습니다.


22-33: Swiper 설정을 검증해주세요

현재 Swiper 구성이 올바르게 작동하는지 확인이 필요합니다:

  1. 이미지 크기가 일관되게 유지되는지
  2. 자동 재생 시간이 사용자 경험에 적절한지
  3. 터치/스와이프 동작이 모바일에서 잘 작동하는지
✅ Verification successful

Swiper 설정이 적절하게 구성되어 있습니다

Swiper 설정을 검토한 결과:

  • 모든 이미지 파일이 public/landing 디렉토리에 정상적으로 존재합니다
  • 슬라이더 설정이 최적화되어 있습니다:
    • 3초 자동 재생 간격 (delay: 3000)
    • 터치/스와이프를 위한 pagination과 navigation 모듈 활성화
    • 무한 루프 (loop: true)
    • 한 번에 하나의 슬라이드만 표시 (slidesPerView: 1)
    • 슬라이드 간 적절한 간격 (spaceBetween: 10)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Swiper 설정 검증
# swiperOptions 상수의 구성 확인
ast-grep --pattern 'export const swiperOptions = {
  $$$
}'

# 이미지 파일 존재 여부 확인
for img in current extract maker makers youtube; do
  fd "${img}.png" public/landing
done

Length of output: 1463

@keemsebin keemsebin merged commit b7cb884 into main Dec 9, 2024
2 checks passed
@keemsebin keemsebin deleted the feat/#84-landing branch December 9, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 랜딩 페이지 UI

3 participants