@@ -27,6 +27,14 @@ import Link from 'next/link'
2727import type { Metadata } from 'next'
2828import { SITE_NAME } from '@/lib/consts'
2929import Image from 'next/image'
30+ import { Calendar } from 'lucide-react'
31+ import {
32+ Card ,
33+ CardContent ,
34+ CardDescription ,
35+ CardHeader ,
36+ CardTitle ,
37+ } from '@/components/ui/card'
3038
3139export const metadata : Metadata = {
3240 title : `Books · ${ SITE_NAME } ` ,
@@ -130,6 +138,70 @@ export default async function Books({
130138 </ TableBody >
131139 </ Table >
132140
141+ < div className = "grid gap-6 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" >
142+ { res . data . map ( ( book ) => (
143+ < Link key = { book . id } href = { `/books/${ book . id } ` } >
144+ < Card className = "group cursor-pointer transition-all duration-200 hover:shadow-lg hover:-translate-y-1" >
145+ < CardHeader className = "pb-3" >
146+ < div className = "relative mx-auto mb-4" >
147+ < div className = "flex items-center justify-center" >
148+ { /* 3D Book Effect */ }
149+ < div className = "relative" >
150+ < div className = "bg-accent [transform:perspective(400px)_rotateY(314deg)] -mr-1 w-3 h-48" >
151+ < span className = "my-2 inline-block text-nowrap text-xs font-bold text-accent-foreground/50 [transform:rotate(90deg)_translateY(-20px)] origin-top-left" >
152+ { book . title . length > 15
153+ ? book . title . substring ( 0 , 15 ) + '...'
154+ : book . title }
155+ </ span >
156+ </ div >
157+ < Image
158+ src = {
159+ book . cover ??
160+ '/placeholder.svg?height=192&width=128&text=No+Cover'
161+ }
162+ alt = { `${ book . title } cover` }
163+ width = { 128 }
164+ height = { 192 }
165+ className = "shadow-xl rounded-r-md w-32 h-48 object-cover [transform:perspective(800px)_rotateY(14deg)] group-hover:[transform:perspective(800px)_rotateY(8deg)] transition-transform duration-300"
166+ />
167+ </ div >
168+ </ div >
169+ </ div >
170+ < CardTitle className = "text-lg line-clamp-2" >
171+ { book . title }
172+ </ CardTitle >
173+ < CardDescription className = "line-clamp-1" >
174+ { book . author }
175+ </ CardDescription >
176+ </ CardHeader >
177+ < CardContent className = "pt-0" >
178+ < div className = "space-y-2" >
179+ { /* <div className="flex items-center gap-2 text-sm text-muted-foreground">
180+ <Hash className="h-3 w-3" />
181+ <span>{book.code}</span>
182+ </div> */ }
183+ < div className = "flex items-center gap-2 text-sm text-muted-foreground" >
184+ < Calendar className = "h-3 w-3" />
185+ < span > { book . year } </ span >
186+ </ div >
187+ { /* {book.genre && (
188+ <Badge variant="outline" className="text-xs">
189+ {book.genre}
190+ </Badge>
191+ )} */ }
192+ { /* <div className="flex justify-between items-center mt-3">
193+ <Badge variant={book.available ? "default" : "destructive"}>
194+ {book.available ? "Available" : "Borrowed"}
195+ </Badge>
196+ <span className="text-xs text-muted-foreground">{book.library}</span>
197+ </div> */ }
198+ </ div >
199+ </ CardContent >
200+ </ Card >
201+ </ Link >
202+ ) ) }
203+ </ div >
204+
133205 < Pagination >
134206 < PaginationContent >
135207 { res . meta . skip > 0 && (
0 commit comments