src/components/page/BookCard.astro 871 B raw
1
---
2
type Book = {
3
	id: number;
4
	title: string;
5
	authors: string;
6
	cover_url: string | null;
7
	notes: string | null;
8
	status: "read" | "reading" | "want";
9
};
10
11
const { book } = Astro.props as { book: Book };
12
---
13
14
<article class="flex items-start gap-4 py-3 border-b border-[#333]">
15
	<div class="flex-shrink-0 w-14 h-20">
16
		{book.cover_url ? (
17
			<img
18
				src={book.cover_url}
19
				alt={`Cover of ${book.title} by ${book.authors}`}
20
				width="56"
21
				height="80"
22
				style="width:56px;height:80px;object-fit:cover;"
23
				loading="lazy"
24
			/>
25
		) : (
26
			<div style="width:56px;height:80px;" class="bg-[#2a2a2a] rounded" />
27
		)}
28
	</div>
29
	<div class="flex flex-col gap-1">
30
		<span class="text-base">{book.title}</span>
31
		<span class="text-xs opacity-50">{book.authors}</span>
32
		{book.notes && (
33
			<span class="text-xs opacity-70 mt-1">{book.notes}</span>
34
		)}
35
	</div>
36
</article>