-
Notifications
You must be signed in to change notification settings - Fork 3
Feat: 스켈레톤 컴포넌트 추가 #148
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: 스켈레톤 컴포넌트 추가 #148
Changes from 8 commits
6b7ea7c
3257b25
536f3b2
17d4514
59ac630
e0e83ee
0878802
ff82386
f8f4f95
52eb474
7b00925
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import CrewSkeleton from '../crew-skeleton'; | ||
|
|
||
| interface CrewSkeletonListProps { | ||
| num: number; | ||
| column?: number; | ||
| } | ||
|
|
||
| export default function CrewSkeletonList({ num, column }: CrewSkeletonListProps) { | ||
| const columnStyle = column === 2 ? 'lg:grid-cols-2' : 'lg:grid-cols-1'; | ||
| return ( | ||
| <div className={`grid grid-cols-1 gap-2 ${columnStyle}`} aria-label="콘텐츠 로딩 중"> | ||
| {[...Array(num)].map((_, index) => ( | ||
| // eslint-disable-next-line react/no-array-index-key | ||
| <CrewSkeleton key={index} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function CrewSkeleton() { | ||
| return ( | ||
| <div className="flex overflow-hidden rounded-xl"> | ||
| <Skeleton className="h-[203px] w-[230px]" /> | ||
| <div className="relative flex flex-1 flex-col gap-2 p-6"> | ||
| <Skeleton className="h-4 w-20" /> | ||
| <Skeleton className="h-4 w-32" /> | ||
| <Skeleton className="h-4 w-40" /> | ||
| <Skeleton className="absolute bottom-6 left-6 right-6 h-2 w-auto" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import GatheringSkeleton from '../gathering-skeleton'; | ||
|
|
||
| interface GatheringSkeletonListProps { | ||
| num: number; | ||
| } | ||
|
|
||
| export default function GatheringSkeletonList({ num }: GatheringSkeletonListProps) { | ||
| return ( | ||
| <div | ||
| className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" | ||
| aria-label="콘텐츠 로딩 중" | ||
| > | ||
| {[...Array(num)].map((_, index) => ( | ||
| // eslint-disable-next-line react/no-array-index-key | ||
| <GatheringSkeleton key={index} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function GatheringSkeleton() { | ||
| return ( | ||
| <div className="flex flex-col overflow-hidden rounded-xl"> | ||
| <Skeleton className="h-[160px] w-full" /> | ||
| <div className="relative flex min-h-[184px] flex-col gap-2 p-4"> | ||
| <Skeleton className="h-4 w-40" /> | ||
| <Skeleton className="h-4 w-32" /> | ||
| <Skeleton className="h-4 w-24" /> | ||
| <Skeleton circle className="absolute right-4 top-4 h-8 w-8" /> | ||
| <Skeleton className="absolute bottom-4 left-4 right-4 h-10 w-auto" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||
| import { Skeleton } from '@mantine/core'; | ||||||||||||
| import MyGatheringSkeleton from '../my-gathering-skeleton'; | ||||||||||||
|
|
||||||||||||
| interface MyGatheringSkeletonListProps { | ||||||||||||
| num: number; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| export default function MyGatheringSkeletonList({ num }: MyGatheringSkeletonListProps) { | ||||||||||||
| return ( | ||||||||||||
| <div> | ||||||||||||
| {[...Array(num)].map((_, index) => ( | ||||||||||||
| // eslint-disable-next-line react/no-array-index-key | ||||||||||||
| <div key={index} className="md:flex"> | ||||||||||||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 배열 생성 및 키 처리 방식 개선 필요 현재 구현에서 발견된 몇 가지 개선이 필요한 부분입니다:
- {[...Array(num)].map((_, index) => (
- // eslint-disable-next-line react/no-array-index-key
- <div key={index} className="md:flex">
+ {Array.from({ length: num }, (_, index) => (
+ <div key={`skeleton-${index}`} className="md:flex">📝 Committable suggestion
Suggested change
|
||||||||||||
| <div className="w-1/6"> | ||||||||||||
| <div className="flex flex-col gap-2"> | ||||||||||||
| <Skeleton className="h-4 w-36" /> | ||||||||||||
| <Skeleton className="h-4 w-20" /> | ||||||||||||
| </div> | ||||||||||||
| </div> | ||||||||||||
| <div className="relative -mb-3.5 w-0.5 bg-gray-200"> | ||||||||||||
| <div className="md:corner-dot" /> | ||||||||||||
| </div> | ||||||||||||
| <div className="flex-1 pb-6 md:pl-8"> | ||||||||||||
| <MyGatheringSkeleton /> | ||||||||||||
| </div> | ||||||||||||
| </div> | ||||||||||||
| ))} | ||||||||||||
| </div> | ||||||||||||
| ); | ||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function MyGatheringSkeleton() { | ||
| return ( | ||
| <div className="flex gap-6 p-6"> | ||
| <Skeleton className="h-28 w-28 rounded-xl md:h-32 md:w-32" /> | ||
| <div className="relative flex flex-col gap-3"> | ||
| <Skeleton className="h-4 w-40" /> | ||
| <div className="flex gap-2"> | ||
| <Skeleton className="h-4 w-32" /> | ||
| <Skeleton className="h-4 w-24" /> | ||
| </div> | ||
| <Skeleton className="absolute bottom-0 h-4 w-24" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
Comment on lines
+1
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification 스켈레톤 컴포넌트가 현재 미사용 상태입니다 검증 결과, MyGatheringSkeleton 컴포넌트는 정의된 파일(src/components/common/skeleton/my-gathering-skeleton/index.tsx) 외에 다른 곳에서 사용되지 않고 있습니다. 이는 다음 두 가지 가능성을 시사합니다:
개발자의 의도에 따라 다음 조치가 필요합니다:
🔗 Analysis chain컴포넌트 사용 패턴 확인 필요 이 스켈레톤 컴포넌트가 다른 페이지들과 일관되게 사용되고 있는지 확인이 필요합니다. Let me try different commands to gather the necessary information. Let me try one more search with different commands to find the component usage. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# 스켈레톤 컴포넌트의 사용 패턴 확인
# MyGatheringSkeleton 컴포넌트의 사용처 확인
echo "MyGatheringSkeleton 사용 현황:"
rg "MyGatheringSkeleton" --type tsx
# 다른 스켈레톤 컴포넌트들과의 일관성 확인
echo "\n다른 스켈레톤 컴포넌트 현황:"
fd --type f ".*skeleton.*\.tsx$" src/components
Length of output: 223 Script: #!/bin/bash
# MyGatheringSkeleton 컴포넌트 사용처 확인
echo "MyGatheringSkeleton 사용 현황:"
rg "MyGatheringSkeleton" -t ts -t tsx
# 다른 스켈레톤 컴포넌트 검색
echo -e "\n스켈레톤 컴포넌트 파일 목록:"
find src/components -type f -name "*skeleton*.tsx"
# 스켈레톤 컴포넌트 임포트 패턴 확인
echo -e "\n스켈레톤 컴포넌트 임포트 패턴:"
rg "import.*Skeleton" -t ts -t tsx
# MyGatheringSkeleton 구현 확인
echo -e "\nMyGatheringSkeleton 구현 확인:"
ast-grep --pattern 'export default function MyGatheringSkeleton() { $$$ }'
Length of output: 1965 Script: #!/bin/bash
# 전체 코드베이스에서 MyGatheringSkeleton 문자열 검색
echo "MyGatheringSkeleton 사용 현황:"
find . -type f -exec grep -l "MyGatheringSkeleton" {} \;
# 스켈레톤 관련 파일 검색 (대소문자 구분 없이)
echo -e "\n스켈레톤 관련 파일:"
find . -type f -iname "*skeleton*.tsx" -o -iname "*skeleton*.ts"
# Mantine Skeleton 임포트 검색
echo -e "\nMantine Skeleton 임포트:"
find . -type f -exec grep -l "@mantine/core.*Skeleton" {} \;
Length of output: 187 |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import MyReviewSkeleton from '../my-review-skeleton'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| interface MyReviewSkeletonListProps { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| num: number; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function MyReviewSkeletonList({ num }: MyReviewSkeletonListProps) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="grid grid-cols-1 gap-6" aria-label="콘텐츠 로딩 중"> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| {[...Array(num)].map((_, index) => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line react/no-array-index-key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <MyReviewSkeleton key={index} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ))} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 컴포넌트 구현에 대한 개선 제안 현재 구현에서 몇 가지 개선할 점이 있습니다:
다음과 같이 개선해보세요: interface MyReviewSkeletonListProps {
num: number;
}
export default function MyReviewSkeletonList({ num }: MyReviewSkeletonListProps) {
+ const skeletonCount = Math.max(0, Math.floor(num));
return (
<div className="grid grid-cols-1 gap-6" aria-label="콘텐츠 로딩 중">
- {[...Array(num)].map((_, index) => (
- // eslint-disable-next-line react/no-array-index-key
- <MyReviewSkeleton key={index} />
+ {Array.from({ length: skeletonCount }, (_, index) => (
+ <MyReviewSkeleton key={`skeleton-${index}`} />
))}
</div>
);
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function MyReviewSkeleton() { | ||
| return ( | ||
| <div className="flex flex-col"> | ||
| <Skeleton className="h-6 w-32" /> | ||
| <div className="relative flex flex-col gap-2 p-6"> | ||
| <Skeleton className="mb-4 h-4 w-40" /> | ||
| <Skeleton className="h-6 w-32" /> | ||
| <Skeleton className="h-4 w-60" /> | ||
| <Skeleton className="absolute bottom-6 h-4 w-20" /> | ||
| <Skeleton className="absolute bottom-6 right-6 h-9 w-30" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function ProfileSkeleton() { | ||
| return ( | ||
| <div className="flex items-center gap-6.5" aria-label="콘텐츠 로딩 중"> | ||
| <Skeleton circle className="h-28 w-28" /> | ||
| <div className="flex flex-col gap-3"> | ||
| <Skeleton className="h-6 w-40" /> | ||
| <Skeleton className="h-4 w-36" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import ReviewableReviewSkeleton from '../reviewable-review-skeleton'; | ||
|
|
||
| interface ReviewableReviewSkeletonListProps { | ||
| num: number; | ||
| } | ||
|
|
||
| export default function ReviewableReviewSkeletonList({ num }: ReviewableReviewSkeletonListProps) { | ||
| return ( | ||
| <div className="grid grid-cols-1 gap-12" aria-label="콘텐츠 로딩 중"> | ||
| {[...Array(num)].map((_, index) => ( | ||
| // eslint-disable-next-line react/no-array-index-key | ||
| <ReviewableReviewSkeleton key={index} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Skeleton } from '@mantine/core'; | ||
|
|
||
| export default function ReviewableReviewSkeleton() { | ||
| return ( | ||
| <div className="flex gap-5"> | ||
| <Skeleton className="h-[166px] w-[230px] rounded-xl" /> | ||
| <div className="relative flex flex-1 flex-col gap-4"> | ||
| <Skeleton className="h-4 w-40" /> | ||
| <Skeleton className="h-4 w-20" /> | ||
| <Skeleton className="absolute bottom-0 h-4 w-28" /> | ||
| <Skeleton className="absolute bottom-0 right-0 h-10 w-28 rounded-xl" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
배열 인덱스를 key로 사용하는 것은 피해야 합니다.
현재 구현에서는 배열 인덱스를 key로 사용하고 있는데, 이는 React의 재조정(reconciliation) 과정에서 문제를 일으킬 수 있습니다. 스켈레톤 아이템의 경우 정적이므로 큰 문제가 되지 않을 수 있으나, 더 안전한 방법을 사용하는 것이 좋습니다.
또한,
Array.from()을 사용하면 스프레드 연산자를 사용하는 것보다 더 명확하고 효율적입니다.📝 Committable suggestion