70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
import { useNavigate } from "react-router-dom";
|
|
|
|
import { MementoBadge } from "../../../../presentation/design-system/index.ts";
|
|
import { Photo } from "./photo.tsx";
|
|
|
|
export function ResurfacedMemoryCard({
|
|
title,
|
|
meta,
|
|
photo,
|
|
memoryId,
|
|
}: Readonly<{
|
|
title: string;
|
|
meta: string;
|
|
photo: number;
|
|
memoryId?: string;
|
|
}>) {
|
|
const navigate = useNavigate();
|
|
return (
|
|
<article
|
|
className="memory-card"
|
|
onClick={() => memoryId && void navigate(`/memories/${memoryId}`)}
|
|
>
|
|
<Photo index={photo} />
|
|
<div className="memory-copy"><span>{meta}</span><strong>{title}</strong></div>
|
|
</article>
|
|
);
|
|
}
|
|
|
|
export function MemoryItem({
|
|
id,
|
|
title,
|
|
meta,
|
|
photo,
|
|
count,
|
|
type = "Memory",
|
|
album = false,
|
|
shared = false,
|
|
showType = true,
|
|
}: Readonly<{
|
|
id: string;
|
|
title: string;
|
|
meta: string;
|
|
photo: number;
|
|
count: number;
|
|
type?: string;
|
|
album?: boolean;
|
|
shared?: boolean;
|
|
showType?: boolean;
|
|
}>) {
|
|
const navigate = useNavigate();
|
|
return (
|
|
<article
|
|
className={`memory-item${album ? " album-list-item" : ""}`}
|
|
data-shared={album ? String(shared) : undefined}
|
|
onClick={() => void navigate(album ? `/albums/${id}` : `/memories/${id}`)}
|
|
>
|
|
<div className="memory-cover">
|
|
<Photo index={photo} />
|
|
{showType ? (
|
|
<MementoBadge className="item-type">
|
|
{album && shared ? "공유 Album" : type}
|
|
</MementoBadge>
|
|
) : null}
|
|
<span className="item-count">{count}</span>
|
|
</div>
|
|
<div className="memory-info"><strong>{title}</strong><span>{meta}</span></div>
|
|
</article>
|
|
);
|
|
}
|