|
1 | 1 | import Link from "next/link" |
| 2 | +import { Pre, Code } from "nextra/components" |
2 | 3 | import Footer from "@/components/Footer" |
3 | | -import { HeroCode } from "@/components/HeroCode" |
| 4 | +import { RichTabs } from "@/components/RichTabs" |
4 | 5 | import { LogosMarquee } from "@/components/LogosMarquee" |
5 | 6 | import { Blur } from "@/components/Blur" |
6 | 7 | import { Guides } from "@/components/Guides" |
7 | | -import { Pre, Code } from "nextra/components" |
| 8 | +import SvelteKit from "../public/img/etc/sveltekit.svg" |
| 9 | +import Express from "../public/img/etc/express.svg" |
| 10 | +import Next from "../public/img/etc/nextjs.svg" |
| 11 | +import Qwik from "../public/img/etc/qwik.svg" |
| 12 | + |
8 | 13 | import { CaretRight } from "@/icons" |
9 | 14 |
|
10 | 15 | <div className="relative overflow-hidden w-full h-full flex flex-col"> |
@@ -74,67 +79,110 @@ import { CaretRight } from "@/icons" |
74 | 79 | <span className="text-xs text-neutral-400">Sponsored</span> |
75 | 80 | </div> |
76 | 81 | </div> |
77 | | - <HeroCode> |
78 | | - <HeroCode.Next> |
79 | | - <Pre data-language="tsx" data-copy=""> |
80 | | - <Code> |
81 | | - |
82 | | - ```tsx |
83 | | - // auth.ts |
84 | | - import NextAuth from "next-auth" |
85 | | - import GitHub from "next-auth/providers/github" |
86 | | - export const { auth, handlers } = NextAuth({ providers: [GitHub] }) |
87 | | - |
88 | | - // middleware.ts |
89 | | - export { auth as middleware } from "@/auth" |
90 | | - |
91 | | - // app/api/auth/[...nextauth]/route.ts |
92 | | - import { handlers } from "@/auth" |
93 | | - export const { GET, POST } = handlers |
94 | | - ``` |
95 | | - |
96 | | - </Code> |
97 | | - </Pre> |
98 | | - </HeroCode.Next> |
99 | | - <HeroCode.Svelte> |
100 | | - <Pre data-language="tsx" data-copy=""> |
101 | | - <Code> |
102 | | - |
103 | | - ```tsx |
104 | | - // src/auth.ts |
105 | | - import { SvelteKitAuth } from "@auth/sveltekit" |
106 | | - import GitHub from '@auth/sveltekit/providers/github' |
| 82 | + <RichTabs |
| 83 | + orientation="horizontal" |
| 84 | + tabKey="hero" |
| 85 | + defaultValue="nextjs" |
| 86 | + className="w-full flex flex-col !py-8 md:!py-16 !m-0 max-w-xl xl:max-w-2xl lg:self-start" |
| 87 | + > |
| 88 | + <RichTabs.List className="justify-between p-2 rounded-t-lg bg-white/40 backdrop-blur dark:bg-neutral-950/25"> |
| 89 | + <div className="flex gap-2"> |
| 90 | + {[ |
| 91 | + { value: "express", src: Express, name: "Express" }, |
| 92 | + { value: "nextjs", src: Next, name: "Next.js" }, |
| 93 | + { value: "qwik", src: Qwik, name: "Qwik" }, |
| 94 | + { value: "sveltekit", src: SvelteKit, name: "SvelteKit" }, |
| 95 | + ].map((trigger) => ( |
| 96 | + <RichTabs.Trigger |
| 97 | + key={trigger.value} |
| 98 | + title={trigger.name} |
| 99 | + value={trigger.value} |
| 100 | + orientation="vertical" |
| 101 | + className=" !border-0 aria-selected:!bg-violet-600 aria-selected:dark:!bg-violet-900 aria-selected:!text-white dark:bg-neutral-800 bg-white !h-auto !w-auto !flex-row !gap-2 !justify-start p-2 px-3 rounded-md outline-none transition-all duration-300 hover:bg-violet-200 hover:dark:bg-violet-900/20 !font-normal" |
| 102 | + > |
| 103 | + <img |
| 104 | + width="24" |
| 105 | + src={trigger.src} |
| 106 | + alt={`${trigger.name} Logo`} |
| 107 | + className="dark:invert" |
| 108 | + /> |
| 109 | + </RichTabs.Trigger> |
| 110 | + ))} |
| 111 | + <Link |
| 112 | + href="/getting-started/integrations" |
| 113 | + className="!border-0 aria-selected:!bg-violet-600 aria-selected:dark:!bg-violet-900 dark:bg-neutral-900 bg-white !h-auto !w-auto !flex-row !gap-2 !justify-start p-2 px-3 rounded-md outline-none transition-all duration-300 flex items-center hover:bg-violet-200 hover:dark:bg-violet-900/20" |
| 114 | + > |
| 115 | + <span className="hidden text-sm md:block">More</span> |
| 116 | + <CaretRight className="size-4" /> |
| 117 | + </Link> |
| 118 | + </div> |
| 119 | + <div className="inline-flex gap-2 items-center self-end pr-4 h-12"> |
| 120 | + <div className="bg-green-300 rounded-full size-4"></div> |
| 121 | + <div className="bg-amber-300 rounded-full size-4"></div> |
| 122 | + <div className="bg-red-300 rounded-full size-4"></div> |
| 123 | + </div> |
| 124 | + </RichTabs.List> |
| 125 | + <div className="p-2 pt-0 w-full rounded-b-lg shadow-md bg-white/40 backdrop-blur dark:bg-neutral-950/25 [&_div]:border-0 [&_div]:shadow-none [&>div.h-full>div>div>pre]:dark:!bg-neutral-950/60 [&>div.h-full>div>div>pre]:!bg-white/60"> |
| 126 | + {Object.entries({ |
| 127 | + nextjs: `\ |
| 128 | +// auth.ts |
| 129 | +import NextAuth from "next-auth" |
| 130 | +import GitHub from "next-auth/providers/github" |
| 131 | +export const { auth, handlers } = NextAuth({ providers: [GitHub] }) |
107 | 132 |
|
108 | | - export const { handle } = SvelteKitAuth({ |
109 | | - providers: [GitHub], |
110 | | - }) |
| 133 | +// middleware.ts |
| 134 | +export { auth as middleware } from "@/auth" |
111 | 135 |
|
112 | | - // src/hooks.server.ts |
113 | | - export { handle } from "./auth" |
114 | | - ``` |
| 136 | +// app/api/auth/[...nextauth]/route.ts |
| 137 | +import { handlers } from "@/auth" |
| 138 | +export const { GET, POST } = handlers |
| 139 | +`, |
| 140 | + sveltekit: `\ |
| 141 | +// src/auth.ts |
| 142 | +import { SvelteKitAuth } from "@auth/sveltekit" |
| 143 | +import GitHub from '@auth/sveltekit/providers/github' |
115 | 144 |
|
116 | | - </Code> |
117 | | - </Pre> |
118 | | - </HeroCode.Svelte> |
119 | | - <HeroCode.Express> |
120 | | - <Pre data-language="tsx" data-copy=""> |
121 | | - <Code> |
| 145 | +export const { handle } = SvelteKitAuth({ |
| 146 | + providers: [GitHub], |
| 147 | +}) |
122 | 148 |
|
123 | | - ```tsx |
124 | | - // server.ts |
125 | | - import { express } from "express" |
126 | | - import { ExpressAuth } from "@auth/express" |
127 | | - import GitHub from "@auth/express/providers/github" |
| 149 | +// src/hooks.server.ts |
| 150 | +export { handle } from "./auth" |
| 151 | +`, |
| 152 | + express: `\ |
| 153 | +// server.ts |
| 154 | +import { express } from "express" |
| 155 | +import { ExpressAuth } from "@auth/express" |
| 156 | +import GitHub from "@auth/express/providers/github" |
128 | 157 |
|
129 | | - const app = express() |
| 158 | +const app = express() |
130 | 159 |
|
131 | | - app.use("/auth/*", ExpressAuth({ providers: [GitHub] })) |
132 | | - ``` |
| 160 | +app.use("/auth/\*", ExpressAuth({ providers: [GitHub] })) |
| 161 | +`, |
| 162 | + qwik: `\ |
| 163 | + |
| 164 | +import { QwikAuth } from "@auth/qwik" |
| 165 | +import GitHub from "@auth/qwik/providers/github" |
| 166 | +export const { onRequest, useSession } = QwikAuth$(() => ({ providers: [GitHub] })) |
| 167 | +` |
| 168 | +}).map(([key, code]) => |
133 | 169 |
|
134 | | - </Code> |
135 | | - </Pre> |
136 | | - </HeroCode.Express> |
137 | | - </HeroCode> |
| 170 | + <RichTabs.Content |
| 171 | + key={key} |
| 172 | + orientation="vertical" |
| 173 | + value={key} |
| 174 | + className="h-full" |
| 175 | + tabIndex={-1} |
| 176 | + > |
| 177 | + <Pre data-language="tsx" data-copy=""> |
| 178 | + <Code data-language="tsx"> |
| 179 | + {code} |
| 180 | + </Code> |
| 181 | + </Pre> |
| 182 | + </RichTabs.Content> |
| 183 | +)} |
| 184 | +</div> |
| 185 | +</RichTabs> |
138 | 186 |
|
139 | 187 | </section> |
140 | 188 | <Guides /> |
|
0 commit comments