Skip to content

Commit 1688a65

Browse files
committed
add docsidebar
1 parent e2782cb commit 1688a65

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/theme/DocSidebar/index.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { WrapperProps } from "@docusaurus/types";
2+
import DocSidebar from "@theme-original/DocSidebar";
3+
import type DocSidebarType from "@theme/DocSidebar";
4+
import React, { type ReactNode } from "react";
5+
6+
function Carbon() {
7+
const ref = React.useRef<HTMLDivElement>(null!);
8+
9+
React.useEffect(() => {
10+
const serve = "CW7IP27L";
11+
const placement = "homarrdev";
12+
ref.current.innerHTML = "";
13+
const s = document.createElement("script");
14+
s.id = "_carbonads_js";
15+
s.src = `//cdn.carbonads.com/carbon.js?serve=${serve}&placement=${placement}`;
16+
ref.current.appendChild(s);
17+
}, []);
18+
19+
return <div ref={ref} className="carbon-outer h-[299px]" />;
20+
}
21+
22+
type Props = WrapperProps<typeof DocSidebarType>;
23+
24+
export default function DocSidebarWrapper(props: Props): ReactNode {
25+
return (
26+
<div>
27+
<DocSidebar {...props} />
28+
<Carbon />
29+
</div>
30+
);
31+
}

0 commit comments

Comments
 (0)