File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed
Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { getListBooks } from '@/lib/api/book'
2626import Link from 'next/link'
2727import type { Metadata } from 'next'
2828import { SITE_NAME } from '@/lib/consts'
29+ import Image from 'next/image'
2930
3031export const metadata : Metadata = {
3132 title : `Books · ${ SITE_NAME } ` ,
@@ -91,6 +92,7 @@ export default async function Books({
9192 { /* <TableCaption>List of books available in the library.</TableCaption> */ }
9293 < TableHeader >
9394 < TableRow >
95+ < TableHead > Cover</ TableHead >
9496 < TableHead > Code</ TableHead >
9597 < TableHead > Title</ TableHead >
9698 < TableHead > Library</ TableHead >
@@ -101,6 +103,19 @@ export default async function Books({
101103 < TableBody >
102104 { res . data . map ( ( b ) => (
103105 < TableRow key = { b . id } >
106+ < TableCell >
107+ { b . cover && (
108+ < div className = "w-12 h-auto" >
109+ < Image
110+ src = { b . cover }
111+ alt = { b . title + "'s cover" }
112+ width = { 50 }
113+ height = { 50 }
114+ className = "rounded"
115+ />
116+ </ div >
117+ ) }
118+ </ TableCell >
104119 < TableCell > { b . code } </ TableCell >
105120 < TableCell > { b . title } </ TableCell >
106121 < TableCell > { b . library ?. name } </ TableCell >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { Cardstaff } from '@/components/staffs/CardStaff'
1818import { Cardsubscription } from '@/components/subscriptions/CardSubscription'
1919import { CardMembership } from '@/components/memberships/CardMembership'
2020import { BtnReturnBook } from '@/components/borrows/BtnReturnBorrow'
21+ import Image from 'next/image'
2122
2223export default async function BorrowDetailsPage ( {
2324 params,
@@ -78,6 +79,15 @@ export default async function BorrowDetailsPage({
7879 </ div >
7980
8081 < div className = "grid grid-cols-1 md:grid-cols-3 gap-4" >
82+ { borrowRes . data . book ?. cover && (
83+ < Image
84+ src = { borrowRes . data . book . cover }
85+ alt = { borrowRes . data . book . title + "'s cover" }
86+ width = { 256 }
87+ height = { 256 }
88+ className = "rounded-lg w-56 h-auto place-self-center row-span-2"
89+ />
90+ ) }
8191 < CardBorrow borrow = { borrowRes . data } />
8292 < CardBook book = { borrowRes . data . book } />
8393 < Carduser user = { borrowRes . data . subscription . user } />
Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ export default async function LibraryDetail({
7979 < Image
8080 src = { libRes . data . logo }
8181 alt = { libRes . data . name }
82- width = { 400 }
83- height = { 400 }
84- className = "rounded-lg w-auto h-auto"
82+ width = { 256 }
83+ height = { 256 }
84+ className = "rounded-lg w-56 h-auto"
8585 />
8686 ) }
8787 < div className = "" >
@@ -102,7 +102,7 @@ export default async function LibraryDetail({
102102 </ div >
103103 </ div >
104104
105- < div className = "grid md:grid-cols-2 gap-4" >
105+ < div className = "grid md:grid-cols-2 gap-4 " >
106106 < div className = "border border-gray-200 my-4" >
107107 < Table >
108108 < TableCaption > Latest added books from the library.</ TableCaption >
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export type Book = WithCommon<{
66 author : string
77 year : number
88 code : string
9+ cover ?: string
910 library_id : string
1011 library ?: Pick < Library , 'id' | 'name' >
1112} >
You can’t perform that action at this time.
0 commit comments