Skip to content

Commit be5bd57

Browse files
committed
chore: Fix rendering for carbon
1 parent c12bda3 commit be5bd57

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/theme/DocSidebar/index.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { useLocation } from "@docusaurus/router";
12
import type { WrapperProps } from "@docusaurus/types";
23
import DocSidebar from "@theme-original/DocSidebar";
34
import type DocSidebarType from "@theme/DocSidebar";
45
import React, { type ReactNode } from "react";
56

67
export function Carbon() {
78
const ref = React.useRef<HTMLDivElement>(null!);
9+
const location = useLocation();
10+
if (process.env.NODE_ENV === "development") {
11+
return null;
12+
}
813

914
React.useEffect(() => {
1015
const serve = "CW7IP27L";
@@ -14,7 +19,7 @@ export function Carbon() {
1419
s.id = "_carbonads_js";
1520
s.src = `//cdn.carbonads.com/carbon.js?serve=${serve}&placement=${placement}`;
1621
ref.current.appendChild(s);
17-
}, []);
22+
}, [location]);
1823

1924
return (
2025
<>
@@ -78,11 +83,10 @@ export function Carbon() {
7883
}
7984
`}
8085
</style>
81-
<div className="ml-auto flex flex-col space-y-4 argos-ignore">
82-
<div className="bg-white dark:bg-black/40 border-gray-500/20 shadow-xl flex flex-col border-t border-l border-b p-4 space-y-2 rounded-l-lg">
83-
<div ref={ref} className="carbon-outer" />
84-
</div>
85-
</div>
86+
<div
87+
ref={ref}
88+
className="bg-background shadow-xl flex flex-col m-4 space-y-2 rounded-l-lg carbon-outer"
89+
/>
8690
</>
8791
);
8892
}

0 commit comments

Comments
 (0)