-
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 3 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}`}> | ||
| {[...Array(num)].map((_, index) => ( | ||
| // eslint-disable-next-line react/no-array-index-key | ||
| <CrewSkeleton key={index} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
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 컴포넌트 구현에 대한 몇 가지 개선사항이 있습니다.
아래와 같이 개선하는 것을 제안드립니다: -export default function CrewSkeletonList({ num, column }: CrewSkeletonListProps) {
- const columnStyle = column === 2 ? 'lg:grid-cols-2' : 'lg:grid-cols-1';
+export default function CrewSkeletonList({
+ skeletonCount,
+ columnCount
+}: CrewSkeletonListProps) {
+ const columnStyle = `lg:grid-cols-${columnCount ?? 1}`;
return (
<div className={`grid grid-cols-1 gap-2 ${columnStyle}`}>
- {[...Array(num)].map((_, index) => (
- // eslint-disable-next-line react/no-array-index-key
- <CrewSkeleton key={index} />
+ {Array.from({ length: skeletonCount }, (_, index) => (
+ <CrewSkeleton
+ key={`skeleton-${index}-${Date.now()}`}
+ />
))}
</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,16 @@ | ||||||||||||||||
| 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"> | ||||||||||||||||
| {[...Array(num)].map((_, index) => ( | ||||||||||||||||
| // eslint-disable-next-line react/no-array-index-key | ||||||||||||||||
| <GatheringSkeleton key={index} /> | ||||||||||||||||
| ))} | ||||||||||||||||
|
Comment on lines
+13
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 배열 인덱스를 key로 사용하는 것은 피해야 합니다. 현재 구현에서는 배열 인덱스를 key로 사용하고 있는데, 이는 React의 재조정(reconciliation) 과정에서 문제를 일으킬 수 있습니다. 스켈레톤 아이템의 경우 정적이므로 큰 문제가 되지 않을 수 있으나, 더 안전한 방법을 사용하는 것이 좋습니다. - {[...Array(num)].map((_, index) => (
- // eslint-disable-next-line react/no-array-index-key
- <GatheringSkeleton key={index} />
- ))}
+ {Array.from({ length: num }, (_, index) => (
+ <GatheringSkeleton key={`skeleton-${index}`} />
+ ))}또한, 📝 Committable suggestion
Suggested change
|
||||||||||||||||
| </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,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,13 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Skeleton } from '@mantine/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function ProfileSkeleton() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-6.5"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <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> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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 접근성 개선이 필요합니다. 스켈레톤 UI의 목적을 스크린 리더 사용자에게도 전달하기 위해 적절한 ARIA 속성을 추가하는 것이 좋습니다. 다음과 같이 수정해보세요: export default function ProfileSkeleton() {
return (
- <div className="flex items-center gap-6.5">
+ <div
+ className="flex items-center gap-6.5"
+ role="status"
+ 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>
);
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
접근성 개선이 필요합니다.
로딩 상태를 스크린 리더 사용자에게도 알려주기 위해 적절한 ARIA 속성을 추가하는 것이 좋습니다.
📝 Committable suggestion