-
-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Docs: 修复 wwads 造成的 client 水合不匹配 (#3106)
- Loading branch information
1 parent
d766455
commit 23bcab5
Showing
1 changed file
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import React from "react"; | ||
|
||
import "./styles.css"; | ||
import { useWindowSize } from "@nullbot/docusaurus-theme-nonepress/client"; | ||
|
||
import type { Props } from "@theme/Page/TOC/Container"; | ||
import OriginTOCContainer from "@theme-original/Page/TOC/Container"; | ||
import "./styles.css"; | ||
|
||
export default function TOCContainer({ | ||
children, | ||
...props | ||
}: Props): JSX.Element { | ||
const windowSize = useWindowSize(); | ||
const isClient = windowSize !== "ssr"; | ||
|
||
return ( | ||
<OriginTOCContainer {...props}> | ||
{children} | ||
<div className="toc-ads-container"> | ||
<div className="wwads-cn wwads-vertical toc-ads" data-id="281"></div> | ||
</div> | ||
{isClient && ( | ||
<div className="toc-ads-container"> | ||
<div className="wwads-cn wwads-vertical toc-ads" data-id="281"></div> | ||
</div> | ||
)} | ||
</OriginTOCContainer> | ||
); | ||
} |