|
1 | 1 | <script lang="ts"> |
2 | | - import spec from 'virtual:openapi-spec'; |
3 | 2 | import RocketIcon from '@lucide/svelte/icons/rocket'; |
4 | 3 | import ZapIcon from '@lucide/svelte/icons/zap'; |
5 | 4 | import PackageIcon from '@lucide/svelte/icons/package'; |
|
13 | 12 | import TerminalIcon from '@lucide/svelte/icons/terminal'; |
14 | 13 | import FileCodeIcon from '@lucide/svelte/icons/file-code'; |
15 | 14 |
|
16 | | - const pathCount = Object.keys(spec.paths || {}).length; |
17 | | - const schemaCount = Object.keys(spec.components?.schemas || {}).length; |
18 | | -
|
19 | 15 | // State for copy buttons |
20 | 16 | let copiedStates = $state({ |
21 | 17 | install: false, |
@@ -43,6 +39,11 @@ export default defineConfig({ |
43 | 39 | openapiPlugin({ |
44 | 40 | baseSchemasPath: 'src/lib/schemas.js', |
45 | 41 | prependPath: '/api', |
| 42 | + info: { |
| 43 | + title: 'My API', |
| 44 | + version: '1.0.0', |
| 45 | + description: 'My API Description' |
| 46 | + }, |
46 | 47 | outputPath: 'static/openapi.json' |
47 | 48 | }), |
48 | 49 | sveltekit() |
@@ -139,9 +140,7 @@ export async function GET({ url }) { |
139 | 140 | </svelte:head> |
140 | 141 |
|
141 | 142 | <!-- Hero Section --> |
142 | | -<section |
143 | | - class="relative overflow-hidden bg-linear-to-br from-indigo-500 via-purple-500 to-pink-500 dark:from-indigo-900 dark:via-purple-900 dark:to-pink-900" |
144 | | -> |
| 143 | +<section class="relative overflow-hidden bg-indigo-600 dark:bg-slate-900"> |
145 | 144 | <div class="container mx-auto px-4 py-24 sm:px-6 lg:px-8"> |
146 | 145 | <div class="mx-auto max-w-4xl text-center text-white"> |
147 | 146 | <div |
@@ -187,26 +186,6 @@ export async function GET({ url }) { |
187 | 186 | </div> |
188 | 187 | </div> |
189 | 188 | </div> |
190 | | - |
191 | | - <!-- Stats Banner --> |
192 | | - <div class="border-t border-white/20 bg-white/10 backdrop-blur"> |
193 | | - <div class="container mx-auto px-4 py-8 sm:px-6 lg:px-8"> |
194 | | - <div class="grid grid-cols-1 gap-6 text-center text-white sm:grid-cols-3"> |
195 | | - <div> |
196 | | - <div class="text-4xl font-bold">{pathCount}</div> |
197 | | - <div class="mt-1 text-sm opacity-90">API Endpoints (Demo)</div> |
198 | | - </div> |
199 | | - <div> |
200 | | - <div class="text-4xl font-bold">{schemaCount}</div> |
201 | | - <div class="mt-1 text-sm opacity-90">Schemas (Demo)</div> |
202 | | - </div> |
203 | | - <div> |
204 | | - <div class="text-4xl font-bold">{spec.info.version}</div> |
205 | | - <div class="mt-1 text-sm opacity-90">API Version</div> |
206 | | - </div> |
207 | | - </div> |
208 | | - </div> |
209 | | - </div> |
210 | 189 | </section> |
211 | 190 |
|
212 | 191 | <!-- Features Section --> |
@@ -455,6 +434,45 @@ export async function GET({ url }) { |
455 | 434 | </div> |
456 | 435 | </section> |
457 | 436 |
|
| 437 | +<!-- Configuration Section --> |
| 438 | +<section id="configuration" class="bg-white py-20 dark:bg-gray-950"> |
| 439 | + <div class="container mx-auto px-4 sm:px-6 lg:px-8"> |
| 440 | + <div class="mx-auto max-w-4xl"> |
| 441 | + <div class="mb-12 text-center"> |
| 442 | + <h2 class="mb-4 text-4xl font-bold text-gray-900 dark:text-white">Configuration</h2> |
| 443 | + <p class="text-lg text-gray-600 dark:text-gray-400"> |
| 444 | + Customize your API documentation details in <code |
| 445 | + class="rounded bg-gray-100 px-2 py-1 text-sm dark:bg-gray-800">vite.config.ts</code |
| 446 | + > |
| 447 | + </p> |
| 448 | + </div> |
| 449 | + <div |
| 450 | + class="relative overflow-hidden rounded-xl border border-gray-200 bg-gray-900 dark:border-gray-700" |
| 451 | + > |
| 452 | + <div |
| 453 | + class="flex items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-2" |
| 454 | + > |
| 455 | + <span class="text-sm font-medium text-gray-300">vite.config.ts</span> |
| 456 | + <button |
| 457 | + onclick={() => copyToClipboard(configExample, 'config')} |
| 458 | + class="inline-flex items-center gap-2 rounded px-3 py-1 text-sm text-gray-300 transition hover:bg-gray-700" |
| 459 | + > |
| 460 | + {#if copiedStates.config} |
| 461 | + <CheckIcon class="h-4 w-4 text-green-400" /> |
| 462 | + <span>Copied!</span> |
| 463 | + {:else} |
| 464 | + <CopyIcon class="h-4 w-4" /> |
| 465 | + <span>Copy</span> |
| 466 | + {/if} |
| 467 | + </button> |
| 468 | + </div> |
| 469 | + <pre class="overflow-x-auto p-4"><code class="text-sm text-gray-100">{configExample}</code |
| 470 | + ></pre> |
| 471 | + </div> |
| 472 | + </div> |
| 473 | + </div> |
| 474 | +</section> |
| 475 | + |
458 | 476 | <!-- Live Demo Section --> |
459 | 477 | <section class="bg-gray-50 py-20 dark:bg-gray-900"> |
460 | 478 | <div class="container mx-auto px-4 sm:px-6 lg:px-8"> |
@@ -505,9 +523,7 @@ export async function GET({ url }) { |
505 | 523 | </section> |
506 | 524 |
|
507 | 525 | <!-- CTA Section --> |
508 | | -<section |
509 | | - class="bg-linear-to-br from-indigo-600 to-purple-600 py-20 dark:from-indigo-900 dark:to-purple-900" |
510 | | -> |
| 526 | +<section class="bg-indigo-700 py-20 dark:bg-indigo-900"> |
511 | 527 | <div class="container mx-auto px-4 text-center sm:px-6 lg:px-8"> |
512 | 528 | <h2 class="mb-6 text-4xl font-bold text-white">Ready to Get Started?</h2> |
513 | 529 | <p class="mb-10 text-xl text-white/90"> |
|
0 commit comments