Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/app/bookshelf/_components/SortableItm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import React from "react";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { likedBook } from "@/types/common";
import noImage from "/public/NoBookImage.jpeg";
import Image from "next/image";

import { useModalStore } from "@/stores/modal";

interface SortableItemProps {
id: string;
book: likedBook;
// 드래그 & 드롭 컨테이너 영역 밖에 있는지 여부
isOutside?: boolean;
}

Expand All @@ -22,13 +22,6 @@ function SortableItem({ id, book }: SortableItemProps) {
});
const { openModalWithIsbn } = useModalStore();

if (!book.thumbnail)
return (
<div className="flexCenter h-full w-full border border-black">
{book.title}
</div>
);

return (
<div
ref={setNodeRef}
Expand All @@ -43,16 +36,21 @@ function SortableItem({ id, book }: SortableItemProps) {
isDragging ? "opacity-50" : "opacity-100"
}`}
key={book.isbn}
onClick={() => {
openModalWithIsbn(book.isbn);
}}
onClick={() => openModalWithIsbn(book.isbn)}
>
<Image
src={book.thumbnail}
src={book.thumbnail || noImage}
fill
alt={book.title}
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw"
className="object-cover"
/>
{/* 제목 오버레이 */}
{!book.thumbnail && (
<figcaption className="absolute inset-0 flex items-center justify-center bg-black/70 p-2 text-center text-sm font-semibold text-white opacity-0 transition-opacity duration-200 hover:opacity-100">
{book.title}
</figcaption>
)}
</figure>
</div>
);
Expand Down