kafka/frontend/src/components/ResultCard.tsx
ashisgreat22 168cb78fab
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6s
Mirror to GitHub / mirror (push) Failing after 3s
Tests / test (push) Failing after 16s
feat: add frontend source code
Add search-zen-50 React SPA source code to frontend/ directory.
Build artifacts (dist, node_modules, lock files) are gitignored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 21:27:45 +01:00

40 lines
1.4 KiB
TypeScript

import type { SearchResult } from "@/lib/mock-data";
interface ResultCardProps {
result: SearchResult;
}
export function ResultCard({ result }: ResultCardProps) {
const domain = result.parsed_url[1];
const faviconUrl = `https://www.google.com/s2/favicons?domain=${domain}&sz=32`;
return (
<a
href={result.url}
target="_blank"
rel="noopener noreferrer"
className="block px-4 py-3 -mx-4 rounded-lg transition-colors hover:bg-result-hover group"
>
<div className="flex items-center gap-2 mb-1">
<img src={faviconUrl} alt="" className="w-4 h-4 rounded-sm" loading="lazy" />
<span className="text-xs text-muted-foreground truncate">{result.pretty_url}</span>
{result.engines.length > 1 && (
<span className="text-[10px] text-muted-foreground/60 ml-auto shrink-0">
{result.engines.length} engines
</span>
)}
</div>
<h3 className="text-link group-hover:text-link-hover font-medium text-base leading-snug mb-1 line-clamp-1">
{result.title}
</h3>
<p className="text-sm text-muted-foreground leading-relaxed line-clamp-2">
{result.content}
</p>
{result.publishedDate && (
<span className="text-xs text-muted-foreground/70 mt-1 inline-block">
{new Date(result.publishedDate).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" })}
</span>
)}
</a>
);
}