-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 프로젝트 목록 기능 추가 (#56) #64
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7a7ff5a
fix: FileDropZone 파일 호버 시 하이라이트 버그 수정 (#56)
YeoEunnn 7606752
feat: 리스트&카드 공동 컴포넌트로 분리 (#56)
YeoEunnn f00f013
feat: 리스트뷰 카드뷰 전환 및 공동 컴포넌트 수정 (#56)
YeoEunnn f549510
fix: gemini 코드 리뷰 수정 (#56)
YeoEunnn aedf9ab
feat: 프로젝트 삭제 모달 띄우기 (#56)
YeoEunnn 4e38b45
refactor: 카드뷰, 리스트뷰 코드 구조 통일 (#56)
YeoEunnn d146a8d
Merge branch 'develop' into feat/hom-add-func-56
AndyH0ng 460a147
Merge branch 'develop' into feat/hom-add-func-56
YeoEunnn ef18b03
refactor: 삭제 모달을 PjSection에서 관리하도록 수정 (#56)
YeoEunnn 0b18488
Merge branch 'feat/hom-add-func-56' into feat/hom-add-func#56
YeoEunnn a32d8a9
Merge pull request #69 from TTORANG/feat/hom-add-func#56
YeoEunnn 6e1e97f
Merge branch 'develop' into feat/hom-add-func-56
YeoEunnn b68e0c9
fix: conflict 수정 (#56)
YeoEunnn fd958c5
fix: conflict 재수정 (#56)
YeoEunnn bf3819b
refactor: Card 코드 구조에 맞게 List 코드 구조 수정 (#56)
YeoEunnn 849ae76
feat: 업로드 실패 시 warning 토스트 알림 추가 (#56)
YeoEunnn 835d32e
Merge branch 'develop' into feat/hom-add-func-56
YeoEunnn 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import type { Key, ReactNode } from 'react'; | ||
|
|
||
| import clsx from 'clsx'; | ||
|
|
||
| export interface CardViewProps<T> { | ||
| items: readonly T[]; | ||
| getKey: (item: T, index: number) => Key; | ||
| renderCard: (item: T) => ReactNode; | ||
| className?: string; | ||
| itemClassName?: string; | ||
| empty?: ReactNode; | ||
| ariaLabal?: string; | ||
| } | ||
|
|
||
| export function CardView<T>({ | ||
| items, | ||
| getKey, | ||
| renderCard, | ||
| className, | ||
| itemClassName, | ||
| empty, | ||
| ariaLabal, | ||
| }: CardViewProps<T>) { | ||
| if (items.length === 0) { | ||
| return <div className="cardView__empty">{empty ?? 'No items'}</div>; | ||
| } | ||
|
|
||
| return ( | ||
| <div className={clsx('cardView', className)} role="list" aria-label={ariaLabal}> | ||
| {items.map((item, index) => ( | ||
| <div | ||
| key={getKey(item, index)} | ||
| className={clsx('cardView__item', itemClassName)} | ||
| role="listitem" | ||
| > | ||
| {renderCard(item)} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default CardView; | ||
YeoEunnn marked this conversation as resolved.
Show resolved
Hide resolved
|
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,54 @@ | ||
| import type { Key, ReactNode } from 'react'; | ||
|
|
||
| import clsx from 'clsx'; | ||
|
|
||
| export interface ListViewProps<T> { | ||
| items: readonly T[]; | ||
| getKey: (item: T, index: number) => Key; | ||
| renderLeading?: (item: T) => ReactNode; | ||
| renderTrailing?: (item: T) => ReactNode; | ||
| renderInfo: (item: T) => ReactNode; | ||
| onItemClick?: (item: T) => void; | ||
| className?: string; | ||
| itemClassName?: string; | ||
| empty?: ReactNode; | ||
| ariaLabel?: string; | ||
| } | ||
|
|
||
| export function ListView<T>({ | ||
| items, | ||
| getKey, | ||
| renderLeading, | ||
| renderTrailing, | ||
| renderInfo, | ||
| className, | ||
| itemClassName, | ||
| empty, | ||
| ariaLabel, | ||
| }: ListViewProps<T>) { | ||
| if (items.length === 0) { | ||
| return <div className="listView__empty">{empty ?? 'No items'}</div>; | ||
| } | ||
|
|
||
| return ( | ||
| <div className={clsx('listView', className)} role="list" aria-label={ariaLabel}> | ||
| {items.map((item, index) => { | ||
| const key = getKey(item, index); | ||
|
|
||
| return ( | ||
| <div key={key} className={clsx('listView__item', itemClassName)} role="listitem"> | ||
| {renderLeading && <div className="listView__leading">{renderLeading(item)}</div>} | ||
|
|
||
| <div className="listView__content">{renderInfo(item)}</div> | ||
|
|
||
| {renderTrailing && ( | ||
| <div className="listView__trailing ml-auto shrink-0">{renderTrailing(item)}</div> | ||
| )} | ||
| </div> | ||
| ); | ||
| })} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default ListView; |
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
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 |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| import type { SortMode, ViewMode } from '@/types/home'; | ||
| import type { Project } from '@/types/project'; | ||
|
|
||
| import { CardView, ListView } from '../common'; | ||
| import ProjectCard from '../projects/ProjectCard'; | ||
| import { ProjectCardSkeleton } from '../projects/ProjectCardSkeleton'; | ||
| import ProjectHeader from '../projects/ProjectHeader'; | ||
| import ProjectList from '../projects/ProjectList'; | ||
|
|
||
| const SKELETON_CARD_COUNT = 9; | ||
| const SKELETON_LIST_COUNT = 6; | ||
|
|
||
| type Props = { | ||
| isLoading: boolean; | ||
|
|
@@ -46,14 +49,40 @@ export default function ProjectsSection({ | |
| onChangeViewMode={onChangeViewMode} | ||
| /> | ||
|
|
||
| {/* 프레젠테이션 목록 */} | ||
| <div className="mt-6 grid grid-cols-2 gap-4 lg:grid-cols-3"> | ||
| {isLoading | ||
| ? Array.from({ length: SKELETON_CARD_COUNT }).map((_, index) => ( | ||
| {viewMode === 'card' ? ( | ||
| isLoading ? ( | ||
| <div className="mt-6 grid grid-cols-2 gap-4 lg:grid-cols-3"> | ||
| {Array.from({ length: SKELETON_CARD_COUNT }).map((_, index) => ( | ||
| <ProjectCardSkeleton key={index} /> | ||
| )) | ||
| : projects.map((project) => <ProjectCard key={project.id} {...project} />)} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ) : ( | ||
| <CardView | ||
| items={projects} | ||
| getKey={(item) => item.id} | ||
| className="mt-6 grid grid-cols-2 gap-4 lg:grid-cols-3" | ||
| renderCard={(item) => <ProjectCard {...item} />} | ||
| /> | ||
| ) | ||
| ) : isLoading ? ( | ||
| <div className="mt-6 flex flex-col gap-3"> | ||
| {Array.from({ length: SKELETON_LIST_COUNT }).map((_, index) => ( | ||
| // TODO | ||
| // ㄴ ProjectListSkeleton도 따로? | ||
| <div | ||
| key={index} | ||
| className="h-20 rounded-2xl border border-gray-200 bg-white p-4 animate-pulse" | ||
| /> | ||
| ))} | ||
| </div> | ||
|
Comment on lines
68
to
77
Contributor
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. |
||
| ) : ( | ||
| <ListView | ||
| items={projects} | ||
| getKey={(item) => item.id} | ||
| className="mt-6 flex flex-col gap-3" | ||
| renderInfo={(item) => <ProjectList {...item} />} | ||
| /> | ||
| )} | ||
| </section> | ||
| ); | ||
| } | ||
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
Oops, something went wrong.
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.