mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 17:25:59 +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 }) => {
|
||||
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 (
|
||||
<SC.TocWrapper>
|
||||
{header}
|
||||
|
||||
Reference in New Issue
Block a user