21 lines
763 B
TypeScript
21 lines
763 B
TypeScript
import type { Note } from "@/types";
|
|
import { Card } from "@/components/ui/Card";
|
|
|
|
interface NoteCardProps {
|
|
note: Note;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
export function NoteCard({ note, onClick }: NoteCardProps) {
|
|
return (
|
|
<Card onClick={onClick}>
|
|
<h3 className="font-medium text-gray-800 truncate">{note.title || "无标题"}</h3>
|
|
<p className="text-sm text-gray-500 mt-1 line-clamp-2">{note.content?.slice(0, 120) || "空笔记"}</p>
|
|
<div className="flex items-center gap-2 mt-2">
|
|
{note.isMarkdown && <span className="text-xs px-1.5 py-0.5 bg-purple-100 text-purple-600 rounded">MD</span>}
|
|
<span className="text-xs text-gray-400">{new Date(note.updatedAt).toLocaleDateString("zh-CN")}</span>
|
|
</div>
|
|
</Card>
|
|
);
|
|
}
|