MCPcopy
hub / github.com/shiyi-0x7f/o-lib / SearchListView

Function SearchListView

src/pages/SearchPage/SearchListView.tsx:17–145  ·  view source on GitHub ↗
({
    books, downloadingIds, favoriteIds,
    getCoverUrl, handleCoverError, onBookClick, onDownload, onToggleFavorite,
}: SearchListViewProps)

Source from the content-addressed store, hash-verified

15}
16
17export default function SearchListView({
18 books, downloadingIds, favoriteIds,
19 getCoverUrl, handleCoverError, onBookClick, onDownload, onToggleFavorite,
20}: SearchListViewProps) {
21 return (
22 <div style={{ display: "flex", flexDirection: "column", gap: "10px", marginBottom: "24px" }}>
23 {books.map((book, i) => {
24 const isDownloading = downloadingIds.has(book.id);
25 const coverUrl = getCoverUrl(String(book.id), book.cover);
26 return (
27 <div
28 onClick={() => onBookClick(book)}
29 key={i}
30 className="card"
31 style={{
32 padding: 0,
33 overflow: "hidden",
34 transition: "all var(--transition-fast)",
35 }}
36 onMouseEnter={(e) => {
37 e.currentTarget.style.borderColor = "var(--accent)";
38 e.currentTarget.style.boxShadow = "var(--shadow-sm)";
39 }}
40 onMouseLeave={(e) => {
41 e.currentTarget.style.borderColor = "var(--border)";
42 e.currentTarget.style.boxShadow = "none";
43 }}
44 >
45 <div style={{ display: "flex" }}>
46 {/* Mini Cover */}
47 <div style={{
48 position: "relative",
49 width: "64px",
50 minHeight: "88px",
51 flexShrink: 0,
52 background: "var(--bg-tertiary)",
53 display: "flex",
54 alignItems: "center",
55 justifyContent: "center",
56 overflow: "hidden",
57 }}>
58 {coverUrl ? (
59 <img
60 src={coverUrl}
61 alt={book.title}
62 loading="lazy"
63 style={{ width: "100%", height: "100%", objectFit: "cover" }}
64 onError={() => handleCoverError(String(book.id))}
65 />
66 ) : (
67 <BookOpen size={22} style={{ opacity: 0.2 }} />
68 )}
69 </div>
70
71 {/* Info */}
72 <div style={{
73 flex: 1, minWidth: 0, padding: "12px 16px",
74 display: "flex", flexDirection: "column", justifyContent: "center",

Callers

nothing calls this directly

Calls 2

formatSizeFunction · 0.90
getCoverUrlFunction · 0.85

Tested by

no test coverage detected