ai-bot/app/(main)/search/ResultBox.tsx

24 lines
901 B
TypeScript
Raw Normal View History

2025-02-25 19:04:37 +08:00
"use client";
import { doSearch } from "@/app/_lib/actions/search";
import { getLinkList } from "@/app/_lib/data/link";
import { LinkBlock } from "@/app/_ui/LinkListBox";
import { useSearchParams } from "next/navigation"
import useSWR from "swr"
2025-02-18 18:36:06 +08:00
export default function ResultBox() {
2025-02-25 19:04:37 +08:00
const searchParams = useSearchParams()
const { data } = useSWR(`${searchParams.get('wd')}`, (e) => doSearch(e))
2025-02-18 18:36:06 +08:00
return <div className="h-[40vh] w-full px-4">
2025-02-25 19:04:37 +08:00
<div className="font-bold">:{`(共${data?.count || 0}条结果)`}</div>
<div className="pl-2 border-l-blue-400 border-0 border-l-2 my-2"></div>
<div className=" grid grid-cols-3 lg:grid-cols-6 gap-4 ">
2025-02-18 18:36:06 +08:00
2025-02-25 19:04:37 +08:00
{
data?.list.map((e: any) => {
return <LinkBlock val={e} key={e._id}></LinkBlock>
})
}
2025-02-18 18:36:06 +08:00
</div>
</div>
}