Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 18 additions & 60 deletions app/page.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,21 @@
import Link from 'next/link';
import { Card } from 'components/card';
import { ContextAlert } from 'components/context-alert';
import { Markdown } from 'components/markdown';
import { RandomQuote } from 'components/random-quote';
import { getNetlifyContext } from 'utils';
import React from 'react';

const contextExplainer = `
The card below is rendered on the server based on the value of \`process.env.CONTEXT\`
([docs](https://docs.netlify.com/configure-builds/environment-variables/#build-metadata)):
`;

const preDynamicContentExplainer = `
The card content below is fetched by the client-side from \`/quotes/random\` (see file \`app/quotes/random/route.js\`) with a different quote shown on each page load:
`;

const ctx = getNetlifyContext();

export default function Page() {
return (
<div className="flex flex-col gap-12 sm:gap-16">
<section>
<ContextAlert className="mb-6" />
<h1 className="mb-4">Netlify Platform Starter – Next.js</h1>
<p className="mb-6 text-lg">
Deploy the latest version of Next.js — including Turbopack, React Compiler, and the new caching APIs
— on Netlify in seconds. No configuration or custom adapter required.
</p>
<Link href="https://docs.netlify.com/frameworks/next-js/overview/" className="btn btn-lg sm:min-w-64">
Read the Docs
</Link>
</section>
{!!ctx && (
<section className="flex flex-col gap-4">
<Markdown content={contextExplainer} />
<RuntimeContextCard />
</section>
)}
<section className="flex flex-col gap-4">
<Markdown content={preDynamicContentExplainer} />
<RandomQuote />
</section>
</div>
);
const Page = () => {
return (
<div>
<h1>Welcome to Kuronami</h1>
<p>
Discover the latest in fashion and technology. For more details, check out our
<a
href="https://kuronami.co.uk/"
target="_blank"
rel="noopener noreferrer"
>
Business
</a> page.
</p>
</div>
);
}

function RuntimeContextCard() {
const title = `Netlify Context: running in ${ctx} mode.`;
if (ctx === 'dev') {
return (
<Card title={title}>
<p>Next.js will rebuild any page you navigate to, including static pages.</p>
</Card>
);
} else {
const now = new Date().toISOString();
return (
<Card title={title}>
<p>This page was statically-generated at build time ({now}).</p>
</Card>
);
}
}
export default Page;