-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] BDYFE-189 카드 리스트 공통 컴포넌트 구현 #182
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
Open
jin-evergreen
wants to merge
5
commits into
develop
Choose a base branch
from
feat/BDYFE-189-card-list-component
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
126487e
feat: 가로 스크롤 카드 리스트 컴포넌트 구현
jin-evergreen 94852bc
feat: 카드 리스트 스켈레톤 UI 구현
jin-evergreen 23ef350
feat: 카드 리스트 스켈레톤 웨이브 애니메이션 적용
jin-evergreen 5d775bd
fix: 카드 리스트 제목 및 이미지 스크롤 접근성 개선
jin-evergreen 6b9ed37
refactor: 공통 스켈레톤 컴포넌트 분리 및 카드 리스트 적용
jin-evergreen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { cn } from '@/lib/cn'; | ||
| import { Skeleton } from '@/shared/components/ui/skeleton/skeleton'; | ||
|
|
||
| const SKELETON_IMAGE_KEYS = [1, 2, 3, 4] as const; | ||
|
|
||
| interface CardListSkeletonProps { | ||
| className?: string; | ||
| } | ||
|
|
||
| export const CardListSkeleton = ({ className }: CardListSkeletonProps) => { | ||
| return ( | ||
| <div | ||
| aria-hidden | ||
| className={cn( | ||
| 'flex w-full min-w-0 flex-col items-start gap-3 overflow-clip', | ||
| className, | ||
| )} | ||
| > | ||
| <div className="flex w-52 flex-col items-start gap-1"> | ||
| <Skeleton className="my-0.5 h-5 w-full rounded-[3px]" /> | ||
| <Skeleton className="my-0.5 h-3.5 w-3/4 rounded-[3px]" /> | ||
| </div> | ||
|
|
||
| <div className="flex items-start gap-2"> | ||
| {SKELETON_IMAGE_KEYS.map((imageKey) => ( | ||
| <Skeleton key={imageKey} className="size-25 shrink-0 rounded-lg" /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| 'use client'; | ||
|
|
||
| import { cn } from '@/lib/cn'; | ||
| import { BookmarkIcon } from '@/shared/components/icons'; | ||
| import { CommonImage } from '@/shared/components/ui/common-image/common-image'; | ||
|
|
||
| interface CardListImage { | ||
| src: string; | ||
| alt: string; | ||
| } | ||
|
|
||
| interface CardListProps { | ||
| title: string; | ||
| description: string; | ||
| images: CardListImage[]; | ||
| isBookmarked: boolean; | ||
| onBookmarkClick: () => void; | ||
| className?: string; | ||
| } | ||
|
|
||
| export const CardList = ({ | ||
| title, | ||
| description, | ||
| images, | ||
| isBookmarked, | ||
| onBookmarkClick, | ||
| className, | ||
| }: CardListProps) => { | ||
| return ( | ||
| <article | ||
| className={cn( | ||
| 'flex w-full min-w-0 flex-col items-start gap-3', | ||
| className, | ||
| )} | ||
| > | ||
| <div className="flex w-full items-center gap-8"> | ||
| <div className="flex min-w-0 flex-1 flex-col items-start gap-1"> | ||
| <h3 className="text-body-sb-16 w-full truncate text-gray-800"> | ||
| {title} | ||
| </h3> | ||
| <p className="text-caption-m-12 w-full truncate text-gray-500"> | ||
| {description} | ||
| </p> | ||
| </div> | ||
|
|
||
| <button | ||
| type="button" | ||
| aria-label={isBookmarked ? '북마크 해제' : '북마크 추가'} | ||
| aria-pressed={isBookmarked} | ||
| className={cn( | ||
| 'focus-visible:outline-mint-300 flex h-6 w-6.25 shrink-0 items-center justify-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid', | ||
| isBookmarked ? 'text-mint-300' : 'text-gray-200', | ||
| )} | ||
| onClick={onBookmarkClick} | ||
| > | ||
| <BookmarkIcon | ||
| className={cn('size-6', isBookmarked && 'fill-current')} | ||
| /> | ||
| </button> | ||
| </div> | ||
|
|
||
| <div | ||
| role="group" | ||
| aria-label={`${title} 이미지 목록`} | ||
| tabIndex={0} | ||
| className="focus-visible:outline-mint-300 flex w-full scrollbar-none items-center gap-2 overflow-x-auto focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid [&::-webkit-scrollbar]:hidden" | ||
| > | ||
| {images.map(({ src, alt }) => ( | ||
| <CommonImage | ||
| key={src} | ||
| src={src} | ||
| alt={alt} | ||
| width={100} | ||
| height={100} | ||
| radius="rounded-xl" | ||
| className="size-25" | ||
| /> | ||
| ))} | ||
| </div> | ||
| </article> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { CardList } from './card-list'; | ||
| export { CardListSkeleton } from './card-list-skeleton'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { cn } from '@/lib/cn'; | ||
|
|
||
| interface SkeletonProps { | ||
| className?: string; | ||
| } | ||
|
|
||
| export const Skeleton = ({ className }: SkeletonProps) => { | ||
| return ( | ||
| <div | ||
| aria-hidden | ||
| className={cn('animate-skeleton-wave bg-gray-200/20', className)} | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| @keyframes skeleton-gradient-wave { | ||
| to { | ||
| transform: translateX(100%); | ||
| } | ||
| } | ||
|
|
||
| @utility animate-skeleton-wave { | ||
| position: relative; | ||
| overflow: hidden; | ||
|
|
||
| &::after { | ||
| position: absolute; | ||
| inset: 0; | ||
| background: linear-gradient( | ||
| 100deg, | ||
| transparent 20%, | ||
| color-mix(in srgb, var(--color-white) 55%, transparent) 50%, | ||
| transparent 80% | ||
| ); | ||
| content: ''; | ||
| transform: translateX(-100%); | ||
| animation: skeleton-gradient-wave 1.7s linear infinite; | ||
| } | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| .animate-skeleton-wave::after { | ||
| animation: none; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.