Skip to content

Commit d5d0bf7

Browse files
committed
Extract openapi to separate component
1 parent 166c974 commit d5d0bf7

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

src/app/docs/openapi/openapi.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use client'
2+
import { useTheme } from 'next-themes'
3+
import { SwaggerDark } from './SwaggerDark'
4+
import { SwaggerLight } from './SwaggerLight'
5+
import { useEffect, useState } from 'react'
6+
import { useMediaQuery } from 'usehooks-ts'
7+
8+
export default function OpenApiTerminusDB() {
9+
return (
10+
<article className="w-full max-w-none">
11+
<div className="">
12+
<h2 className="font-display text-3xl tracking-tight text-slate-900 dark:text-white">
13+
OpenAPI spec
14+
</h2>
15+
<div className="mt-8 rounded-md bg-slate-50 py-1">
16+
<SwaggerLight />
17+
</div>
18+
</div>
19+
</article>
20+
)
21+
}

src/app/docs/openapi/page.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
'use client'
2-
import { useTheme } from 'next-themes'
3-
import { SwaggerDark } from './SwaggerDark'
4-
import { SwaggerLight } from './SwaggerLight'
5-
import { useEffect, useState } from 'react'
6-
import { useMediaQuery } from 'usehooks-ts'
1+
72
import { Metadata } from 'next'
3+
import OpenApiTerminusDB from './openapi'
84
// const SwaggerUI = dynamic(import('swagger-ui-react'), { ssr: false })
95

106
export const metadata: Metadata = {
@@ -20,16 +16,7 @@ export const metadata: Metadata = {
2016
const OpenApi = () => {
2117
return (
2218
<div className="w-full max-w-2xl min-w-0 flex-auto px-4 py-16 lg:max-w-none lg:pr-0 lg:pl-8 xl:px-16">
23-
<article className="w-full max-w-none">
24-
<div className="">
25-
<h2 className="font-display text-3xl tracking-tight text-slate-900 dark:text-white">
26-
OpenAPI spec
27-
</h2>
28-
<div className="mt-8 rounded-md bg-slate-50 py-1">
29-
<SwaggerLight />
30-
</div>
31-
</div>
32-
</article>
19+
<OpenApiTerminusDB/>
3320
</div>
3421
)
3522
}

0 commit comments

Comments
 (0)