Skip to content

Commit

Permalink
fix(docs): codeblock correct theme (#1006)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
baldasseva and HonzaTuron authored May 16, 2024
1 parent cac9ff3 commit ed5a39b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/components/UiLibraryWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import { UiDependencyProvider } from '@apify-packages/ui-library';
import Link from '@docusaurus/Link';
import { useColorMode } from '@docusaurus/theme-common';
import useBaseUrl from '@docusaurus/useBaseUrl';
import React, { PropsWithChildren } from 'react';
import React, { PropsWithChildren, useEffect, useState } from 'react';

export default function UiLibraryWrapper({ children }: PropsWithChildren) {
const [themeIsDark, setThemeIsDark] = useState(true);
const isDark = useColorMode().isDarkTheme;
useEffect(() => {
setThemeIsDark(isDark);
}, [isDark]);

return (
<UiDependencyProvider dependencies={{
InternalLink: (props) => <Link {...props} />,
windowLocationHost: useBaseUrl(''),
isHrefTrusted: () => true,
uiTheme: useColorMode().isDarkTheme ? 'DARK' : 'LIGHT',
uiTheme: themeIsDark ? 'DARK' : 'LIGHT',
}}>{children}</UiDependencyProvider>
);
}

0 comments on commit ed5a39b

Please sign in to comment.