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
36 changes: 18 additions & 18 deletions app/page.jsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
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';
Link 'next/link';
{ Card } 'components/card';
{ ContextAlert } 'components/context-alert';
{ Markdown } 'components/markdown';
{ RandomQuote } 'components/random-quote';
{ getNetlifyContext } 'utils';

const contextExplainer = `
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 = `
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 postDynamicContentExplainer = `
postDynamicContentExplainer = `
On Netlify, Next.js Route Handlers are automatically deployed as [Serverless Functions](https://docs.netlify.com/functions/overview/).
Alternatively, you can add Serverless Functions to any site regardless of framework, with acccess to the [full context data](https://docs.netlify.com/functions/api/).

And as always with dynamic content, beware of layout shifts & flicker! (here, we aren't...)
`;

const ctx = getNetlifyContext();
ctx = getNetlifyContext();

export default function Page() {
return (
Page() {
(
<div className="flex flex-col gap-12 sm:gap-16">
<section>
<ContextAlert className="mb-6" />
Expand All @@ -49,16 +49,16 @@ export default function Page() {
);
}

function RuntimeContextCard() {
const title = `Netlify Context: running in ${ctx} mode.`;
if (ctx === 'dev') {
return (
RuntimeContextCard() {
title = `Netlify Context: running in ${ctx} mode.`;
(ctx === 'dev') {

<Card title={title}>
<p>Next.js will rebuild any page you navigate to, including static pages.</p>
</Card>
);
} else {
return (
}{
(
<Card title={title}>
<p>This page was statically-generated at build time.</p>
</Card>
Expand Down