"use client"; import Image from "next/image"; import Link from "next/link"; import { SearchIcon } from "lucide-react"; import { useState } from "react"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Empty, EmptyDescription, EmptyHeader, EmptyTitle, } from "@/components/ui/empty"; import { InputGroup, InputGroupAddon, InputGroupInput, } from "@/components/ui/input-group"; type GuideCard = { id: string; slug: string; name: string; overview: string; coverUrl: string; version: number; }; export function StructuredDirectory({ guides }: { guides: GuideCard[] }) { const [query, setQuery] = useState(""); const normalized = query.trim().toLowerCase(); const filtered = guides.filter((guide) => `${guide.name} ${guide.overview}`.toLowerCase().includes(normalized), ); return (
setQuery(event.target.value)} placeholder="ค้นหา Guide…" aria-label="ค้นหา Guide" /> {filtered.length ? (
{filtered.map((guide) => (
{`Guide
{guide.name} {guide.overview}
))}
) : ( ไม่พบ Guide ลองค้นหาด้วยชื่อตัวละครอื่น )}
); }