-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
도서관 코드 개선 완료
- Loading branch information
Showing
23 changed files
with
288 additions
and
166 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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
125 changes: 61 additions & 64 deletions
125
apps/member/src/components/library/BookDetailSection/BookDetailSection.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
41 changes: 41 additions & 0 deletions
41
apps/member/src/components/library/BookLoanHistorySection/BookLoanHistorySection.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Section from '@components/common/Section/Section'; | ||
import { Table, Badge } from '@clab/design-system'; | ||
import { useBookLoanRecordConditions } from '@hooks/queries'; | ||
import { formattedDate } from '@utils/date'; | ||
import { TABLE_HEAD } from '@constants/head'; | ||
|
||
interface BookLoanHistorySectionProps { | ||
bookId: number; | ||
} | ||
|
||
const BookLoanHistorySection = ({ bookId }: BookLoanHistorySectionProps) => { | ||
const { data } = useBookLoanRecordConditions({ bookId }); | ||
|
||
return ( | ||
<Section> | ||
<Section.Header title="대여 내역"> | ||
최근에 신청된 대여 내역이에요 | ||
</Section.Header> | ||
<Section.Body> | ||
<Table head={TABLE_HEAD.BOOK_LOAN_RECORD}> | ||
{data.items.map(({ borrowerId, borrowedAt, returnedAt }, index) => ( | ||
<Table.Row key={index}> | ||
<Table.Cell>{borrowerId}</Table.Cell> | ||
<Table.Cell>{formattedDate(borrowedAt)}</Table.Cell> | ||
<Table.Cell> | ||
{returnedAt ? formattedDate(returnedAt) : '예정'} | ||
</Table.Cell> | ||
<Table.Cell> | ||
<Badge color={returnedAt ? 'green' : 'red'}> | ||
{returnedAt ? '반납완료' : '대여중'} | ||
</Badge> | ||
</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table> | ||
</Section.Body> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default BookLoanHistorySection; |
42 changes: 42 additions & 0 deletions
42
apps/member/src/components/library/LibraryNewBooksSection/LibraryNewBooksSection.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Section from '@components/common/Section/Section'; | ||
import { BookItem } from '@type/book'; | ||
import Image from '@components/common/Image/Image'; | ||
import { Link } from 'react-router-dom'; | ||
import { PATH_FINDER } from '@constants/path'; | ||
|
||
interface LibraNewBooksSectionProps { | ||
data: BookItem[]; | ||
} | ||
|
||
const LibraryNewBooksSection = ({ data }: LibraNewBooksSectionProps) => { | ||
return ( | ||
<Section> | ||
<Section.Header title="신규 도서"> | ||
최근에 들어온 도서들을 확인해보세요 | ||
</Section.Header> | ||
<Section.Body className="flex gap-4"> | ||
{data.map(({ id, imageUrl, title, author, publisher }) => ( | ||
<Link | ||
key={id} | ||
to={PATH_FINDER.BOOK_DETAIL(id)} | ||
className="relative flex flex-col gap-2 transition-transform group hover:scale-110" | ||
> | ||
<div className="overflow-hidden rounded-lg"> | ||
<Image src={imageUrl} alt={title} className="object-cover " /> | ||
</div> | ||
|
||
<div className="absolute inset-0 transition-all rounded-lg opacity-0 pointer-events-none group-hover:opacity-100 bg-gradient-to-t from-black/60 via-black/30" /> | ||
<div className="absolute bottom-0 px-2 text-white transition-all opacity-0 group-hover:-translate-y-5 group-hover:opacity-100"> | ||
<p className="font-semibold break-keep">{title}</p> | ||
<p className="text-sm"> | ||
{author} | {publisher} | ||
</p> | ||
</div> | ||
</Link> | ||
))} | ||
</Section.Body> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default LibraryNewBooksSection; |
Oops, something went wrong.