-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
434dd8c
commit 434dd73
Showing
11 changed files
with
144 additions
and
171 deletions.
There are no files selected for viewing
This file contains 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
2 changes: 1 addition & 1 deletion
2
src/stories/bookShelf/BookShelf.stories.tsx → ...ories/bookShelf/BookShelfCard.stories.tsx
This file contains 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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,60 @@ | ||
'use client'; | ||
|
||
import useAuthRecommendedBooks from '@/queries/recommend/useAuthRecommendedBooks'; | ||
import useAuthRecommendedBookshelf from '@/queries/recommend/useAuthRecommendedBookshelf'; | ||
import { APIJobGroup } from '@/types/job'; | ||
import BookCover from '@/v1/book/BookCover'; | ||
import BookShelfCard from '@/v1/bookShelf/BookShelfCard'; | ||
import Link from 'next/link'; | ||
|
||
const BookArchiveForAuth = ({ | ||
userJobGroup, | ||
}: { | ||
userJobGroup: APIJobGroup['name']; | ||
}) => { | ||
const { | ||
data: bookshelfData, | ||
isSuccess: bookshelfIsSuccess, | ||
isLoading: bookshelfIsLoading, | ||
} = useAuthRecommendedBookshelf(userJobGroup); | ||
const { | ||
data: booksData, | ||
isSuccess: booksIsSuccess, | ||
isLoading: booksIsLoading, | ||
} = useAuthRecommendedBooks(userJobGroup); | ||
|
||
const isSuccess = bookshelfIsSuccess && booksIsSuccess; | ||
const isLoading = bookshelfIsLoading && booksIsLoading; | ||
|
||
if (isLoading) { | ||
// TODO: 스켈레톤 컴포넌트로 교체 | ||
return null; | ||
} | ||
|
||
if (!isSuccess) return null; | ||
if (!bookshelfData || !booksData) return null; | ||
|
||
return ( | ||
<div className="flex w-full flex-col gap-[1.5rem] text-md font-bold"> | ||
<h2>👀 이런 책들이 많이 꽂혔어요</h2> | ||
<ul className="flex gap-[1.5rem] overflow-auto"> | ||
{booksData.books.map(({ bookId, imageUrl, title }) => ( | ||
<li key={bookId} className="max-w-[9rem]"> | ||
<Link href={`/book/${bookId}`} className="flex flex-col gap-[1rem]"> | ||
<BookCover src={imageUrl} title={title} size="large" /> | ||
<span className="line-clamp-2 break-keep text-center text-xs font-normal leading-tight"> | ||
{title} | ||
</span> | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
<h2>🔥 인기 책장</h2> | ||
{...bookshelfData.bookshelfResponses.map(bookShelf => ( | ||
<BookShelfCard key={bookShelf.bookshelfId} {...bookShelf} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BookArchiveForAuth; |
This file contains 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,25 @@ | ||
'use client'; | ||
|
||
import useUnAuthRecommendedBookshelfQuery from '@/queries/recommend/useUnAuthRecommendedBookshelfQuery'; | ||
import BookShelfCard from '@/v1/bookShelf/BookShelfCard'; | ||
|
||
const BookArchiveForUnAuth = () => { | ||
const { data, isSuccess, isLoading } = useUnAuthRecommendedBookshelfQuery(); | ||
|
||
if (isLoading) { | ||
// TODO: 스켈레톤 컴포넌트로 교체 | ||
return null; | ||
} | ||
if (!isSuccess) return null; | ||
|
||
return ( | ||
<div className="flex w-full flex-col gap-[1.5rem] text-md font-bold"> | ||
<h2>🔥 인기 책장</h2> | ||
{...data.bookshelfResponses.map(bookShelf => ( | ||
<BookShelfCard key={bookShelf.bookshelfId} {...bookShelf} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BookArchiveForUnAuth; |
This file was deleted.
Oops, something went wrong.
This file contains 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