Skip to content

Commit 28b084f

Browse files
committed
Fixed build error for elements module
1 parent 143a17c commit 28b084f

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/app/openapi/page.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,32 @@
33
import React from 'react';
44
import Link from 'next/link'
55
import { ArrowLeftIcon } from '@heroicons/react/20/solid';
6-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
7-
// @ts-ignore
8-
import { API } from '@stoplight/elements';
6+
import dynamic from 'next/dynamic';
97
import '@stoplight/elements/styles.min.css';
8+
import './styles.css';
109

11-
import './styles.css'
10+
interface OpenApiProps {
11+
apiDescriptionUrl: string;
12+
router: 'history' | 'hash' | 'memory';
13+
}
1214

13-
const OpenAPi = () => (
15+
// @ts-ignore - Ignoring TypeScript errors for dynamic import
16+
const OpenAPi = dynamic<OpenApiProps>(() => import('@stoplight/elements').then(mod => mod.API), {
17+
ssr: false
18+
})
19+
20+
const OpenApiPage: React.FC = () => (
1421
<div className="App">
1522
<nav className='p-6 bg-white'>
1623
<Link href='/' className="!font-grotesk group inline-flex items-center text-sm text-gray-600 hover:text-gray-800 font-medium">
1724
<ArrowLeftIcon className="inline h-3 mr-2 transition-transform group-hover:-translate-x-1" /> Back to Docs
1825
</Link>
1926
</nav>
20-
<API
27+
<OpenAPi
2128
apiDescriptionUrl="./openapi/openapi.Sourcegraph.Latest.yaml"
2229
router="hash"
2330
/>
2431
</div>
2532
)
2633

27-
export default OpenAPi
34+
export default OpenApiPage

0 commit comments

Comments
 (0)