/** * 线索项组件 * 可复用的线索展示组件,处理线索的点击、已浏览标记等 */ import { Image } from "@/components"; import { cn, getStaticImage } from "@/lib/utils"; import type { ClueKey } from "./types"; export interface ClueItemProps { /** 线索键名 */ clueKey: ClueKey; /** 线索图片路径 */ imageSrc: string; /** 是否已浏览 */ isViewed: boolean; /** 点击回调 */ onClick: () => void; /** 自定义类名 */ className?: string; /** 已浏览标记的位置偏移 */ viewedMarkOffset?: { left?: string; top?: string; bottom?: string }; /** 已浏览标记文本,默认为"已浏览" */ viewedText?: string; /** 线索类型:普通线索或电话线索 */ type?: "normal" | "phone"; } /** * 线索项组件 * 显示线索图片、搜索动画(未浏览时)、已浏览标记(已浏览时) */ export const ClueItem = ({ clueKey, imageSrc, isViewed, onClick, className, viewedMarkOffset = {}, viewedText = "已浏览", type = "normal", }: ClueItemProps) => { // 根据线索类型确定搜索图标的位置 const searchIconPosition = type === "phone" ? "left-[45%] top-[45%]" : "left-1/2 top-[45%]"; return (
{/* 线索图片 */} {/* 搜索图标 - 未浏览时显示 */} {!isViewed && ( )} {/* 已浏览标记 */} {isViewed && (
{viewedText}
)}
); };