Skip to content

Commit ed5a39b

Browse files
fix(docs): codeblock correct theme (#1006)
In page /sdk and /api expecially, now the color of the Codeblock texts is working with the color theme of the page --------- Co-authored-by: HonzaTuron <[email protected]>
1 parent cac9ff3 commit ed5a39b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/UiLibraryWrapper.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@ import { UiDependencyProvider } from '@apify-packages/ui-library';
22
import Link from '@docusaurus/Link';
33
import { useColorMode } from '@docusaurus/theme-common';
44
import useBaseUrl from '@docusaurus/useBaseUrl';
5-
import React, { PropsWithChildren } from 'react';
5+
import React, { PropsWithChildren, useEffect, useState } from 'react';
66

77
export default function UiLibraryWrapper({ children }: PropsWithChildren) {
8+
const [themeIsDark, setThemeIsDark] = useState(true);
9+
const isDark = useColorMode().isDarkTheme;
10+
useEffect(() => {
11+
setThemeIsDark(isDark);
12+
}, [isDark]);
13+
814
return (
915
<UiDependencyProvider dependencies={{
1016
InternalLink: (props) => <Link {...props} />,
1117
windowLocationHost: useBaseUrl(''),
1218
isHrefTrusted: () => true,
13-
uiTheme: useColorMode().isDarkTheme ? 'DARK' : 'LIGHT',
19+
uiTheme: themeIsDark ? 'DARK' : 'LIGHT',
1420
}}>{children}</UiDependencyProvider>
1521
);
1622
}

0 commit comments

Comments
 (0)