-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.tsx
More file actions
52 lines (45 loc) · 1.38 KB
/
page.tsx
File metadata and controls
52 lines (45 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* This module defines a page component for the home page.
*
* @see HomePage
*
* @see https://nextjs.org/docs/app/building-your-application/routing/defining-routes
* @see https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#pages
*
* It uses React Server Components to fetch and render data on the server.
*
* @see https://nextjs.org/docs/app/building-your-application/rendering/server-components
*/
import Link from "next/link";
import { Search } from "@/app/_search";
import {
searchRestaurants,
type SearchQueryInput,
} from "@/services/restaurants/fetch";
type HomePageProps = {
searchParams: SearchQueryInput;
};
/**
* The component for the home page.
*
* This is rendered when the user navigates to the root URL, `/`.
*
*/
export default async function HomePage({ searchParams }: HomePageProps) {
// Use the search parameters in the URL to search for restaurants
const searchResults = await searchRestaurants(searchParams);
return (
<div>
<h1 className="text-3xl font-bold">Golden Plate Map</h1>
<p>Find the best restaurants in California</p>
<Search />
<p>Search results: </p>
<pre className="bg-slate-200">
{JSON.stringify(searchResults, null, 2)}
</pre>
<Link href="/restaurant/1" className="text-blue-600 underline">
Example restaurant page
</Link>
</div>
);
}