import { Lecture, LessonTypeLabel } from "@nice/common";

// 修改 PostSelectOption 组件
export default function PostSelectOption({ post }: { post: Lecture }) {
	return (
		<div className="flex items-center gap-2 min-w-0">
			{" "}
			{/* 添加 min-w-0 */}
			<img
				src={post?.meta?.thumbnail || "/placeholder.webp"}
				className="w-8 h-8 object-cover rounded flex-shrink-0" // 添加 flex-shrink-0
				alt="课程封面"
			/>
			<div className="flex flex-col min-w-0 flex-1">
				{" "}
				{/* 修改这里 */}
				{post?.meta?.type && (
					<span className="text-sm text-gray-500 truncate">
						{LessonTypeLabel[post?.meta?.type]}
					</span>
				)}
				<span className="font-medium truncate">{post?.title}</span>
			</div>
		</div>
	);
}
