rsnext/examples/with-supabase/components/ConnectSupabaseSteps.tsx
Jon Meyers d0e92b19af
chore: Refactor with-supabase example to use ssr package (#57100)
### What?

[1] Refactors `with-supabase` example to use new `@supabase/ssr` package
[2] Makes landing page dynamic steps to connect Next.js to Supabase
[3] Fixes a range of small bugs

### Why?

[1] Simplifies creating a Supabase client
[2] People were not understanding how to connect this template to Supabase
[3] People don't like bugs

### How?

[1] Declares a separate `createClient` function for client and server. Client version is used in Client Components, server version is used every where else - Server Components, Route Handlers, Server Actions, Middleware
[2] Makes landing page a dynamic list of next steps to guide the user to success
[3] Writing code to squash the bugs!
2023-10-23 23:34:10 +00:00

62 lines
1.8 KiB
TypeScript

import Step from './Step'
export default function ConnectSupabaseSteps() {
return (
<ol className="flex flex-col gap-6">
<Step title="Create Supabase project">
<p>
Head over to{' '}
<a
href="https://app.supabase.com/project/_/settings/api"
target="_blank"
className="font-bold hover:underline text-foreground/80"
rel="noreferrer"
>
database.new
</a>{' '}
and create a new Supabase project.
</p>
</Step>
<Step title="Declare environment variables">
<p>
Rename the{' '}
<span className="px-2 py-1 rounded-md bg-foreground/20 text-foreground/80">
.env.example
</span>{' '}
file in your Next.js app to{' '}
<span className="px-2 py-1 rounded-md bg-foreground/20 text-foreground/80">
.env.local
</span>{' '}
and populate with values from{' '}
<a
href="https://app.supabase.com/project/_/settings/api"
target="_blank"
className="font-bold hover:underline text-foreground/80"
rel="noreferrer"
>
your Supabase project's API Settings
</a>
.
</p>
</Step>
<Step title="Restart your Next.js development server">
<p>
You may need to quit your Next.js development server and run{' '}
<span className="px-2 py-1 rounded-md bg-foreground/20 text-foreground/80">
npm run dev
</span>{' '}
again to load the new environment variables.
</p>
</Step>
<Step title="Refresh the page">
<p>
You may need to refresh the page for Next.js to load the new
environment variables.
</p>
</Step>
</ol>
)
}