| 1 | import { Card } from "./components/Card"; |
| 2 | import { Counter } from "./components/Counter"; |
| 3 | import { submitName } from "./actions"; |
| 4 | import Image from "next/image"; |
| 5 | |
| 6 | // Server-rendered in the Neon Functions runtime on every request. |
| 7 | export const dynamic = "force-dynamic"; |
| 8 | |
| 9 | export const metadata = { |
| 10 | title: "Next.js on Neon", |
| 11 | }; |
| 12 | |
| 13 | export default async function Home({ searchParams }) { |
| 14 | const { submitted } = await searchParams; |
| 15 | return ( |
| 16 | <main> |
| 17 | <h1 className="text-3xl font-bold">{process.env.GREETING ?? "Hello!"}</h1> |
| 18 | <Card |
| 19 | title="Styled with Tailwind CSS" |
| 20 | body="This card is a React component styled with Tailwind utilities." |
| 21 | /> |
| 22 | <Image |
| 23 | src="/logo.svg" |
| 24 | alt="Neon Website" |
| 25 | width={160} |
| 26 | height={48} |
| 27 | unoptimized |
| 28 | /> |
| 29 | <Counter /> |
| 30 | <form action={submitName}> |
| 31 | <label htmlFor="name">Your name</label> |
| 32 | <input id="name" name="name" required maxLength={64} /> |
| 33 | <button type="submit">Submit name</button> |
| 34 | </form> |
| 35 | {submitted && <p role="status">Submitted: {submitted}</p>} |
| 36 | <a href="/api/stream">Stream events</a> |
| 37 | <a href="/redirect">Follow redirect</a> |
| 38 | </main> |
| 39 | ); |
| 40 | } |