import React, { FormEvent } from "react"
import Link from "next/link"
import { ArrowLeftIcon } from "@heroicons/react/24/outline"
import { formatDate } from "@/utils"
import SimplifiedSearchBar from "@/components/SimplifiedSearchBar"
type Props = {
searchParams: {
q?: string
}
}
const Page = async ({ searchParams }: Props) => {
const query = searchParams.q ?? ""
const results = await getResults({ query: searchParams.q })
return (
{results.length > 0 && (
<>
{results.map((item) => (
{formatDate(item.timestamp)}
{item.title}
))}
>
)}
)
}
async function getResults({
query
}: {
query?: string
}): Promise {
if (!query) return []
return [
{
id: 1,
timestamp: new Date(),
title: "Mock Title 1",
description: "Mock Description 1"
},
{
id: 2,
timestamp: new Date(),
title: "Mock Title 2",
description: "Mock Description 2"
}
]
}
export default Page