/
server-side-error.tsx
34 lines (32 loc) · 1004 Bytes
/
server-side-error.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React, { ReactElement } from 'react'
import { useMounted } from 'nextra/hooks'
import { useConfig } from '../contexts'
import { renderComponent, getGitIssueUrl } from '../utils'
import { useRouter } from 'next/router'
import { Anchor } from './anchor'
export function ServerSideErrorPage(): ReactElement | null {
const config = useConfig()
const mounted = useMounted()
const { asPath } = useRouter()
const { link, labels } = config.serverSideError
if (!link) {
return null
}
return (
<p>
<Anchor
href={getGitIssueUrl({
repository: config.docsRepositoryBase,
title: `Got server-side error in \`${
mounted ? asPath : ''
}\` url. Please fix!`,
labels
})}
newWindow
className="ring-primary-500/30 focus:outline-none focus-visible:ring text-primary-500 underline decoration-from-font [text-underline-position:under]"
>
{renderComponent(link)}
</Anchor>
</p>
)
}