mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
build: resolve build related to global window
This commit is contained in:
@@ -23,7 +23,14 @@ function extractTitle(title: string): ITitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Toc: FC<ITocProps> = ({ header, items }) => {
|
export const Toc: FC<ITocProps> = ({ header, items }) => {
|
||||||
const { pathname } = window.location
|
const windowGlobal = typeof window !== "undefined" && window
|
||||||
|
|
||||||
|
// window is not available on build
|
||||||
|
if (!windowGlobal) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const { pathname } = windowGlobal.location
|
||||||
return (
|
return (
|
||||||
<SC.TocWrapper>
|
<SC.TocWrapper>
|
||||||
{header}
|
{header}
|
||||||
|
|||||||
Reference in New Issue
Block a user