-
{colors.dark && colors.light && }
+
{themeSwitchEnabled && }
);
diff --git a/packages/ui/app/src/sidebar/SidebarLink.tsx b/packages/ui/app/src/sidebar/SidebarLink.tsx
index 57dfd7d1de..85ab9232bb 100644
--- a/packages/ui/app/src/sidebar/SidebarLink.tsx
+++ b/packages/ui/app/src/sidebar/SidebarLink.tsx
@@ -20,9 +20,9 @@ import {
useRef,
} from "react";
import { ChevronDown } from "react-feather";
+import { useAtomEffect } from "../atoms";
import { SIDEBAR_SCROLL_CONTAINER_ATOM, useCloseMobileSidebar } from "../atoms/sidebar";
import { FernLink } from "../components/FernLink";
-import { useAtomEffect } from "../hooks/useAtomEffect";
import { getRouteNodeWithAnchor } from "../util/anchor";
import { slugToHref } from "../util/slugToHref";
import { scrollToCenter } from "./utils";
diff --git a/packages/ui/app/src/themes/default/DefaultDocs.tsx b/packages/ui/app/src/themes/default/DefaultDocs.tsx
index 1a6ec060f5..0636ec7786 100644
--- a/packages/ui/app/src/themes/default/DefaultDocs.tsx
+++ b/packages/ui/app/src/themes/default/DefaultDocs.tsx
@@ -1,10 +1,9 @@
import clsx from "clsx";
import { useAtomValue } from "jotai";
-import { useTheme } from "next-themes";
import { ReactElement, memo } from "react";
import { CONTENT_HEIGHT_ATOM, DOCS_LAYOUT_ATOM, HEADER_OFFSET_ATOM, SHOW_HEADER_ATOM } from "../../atoms/layout";
import { SIDEBAR_DISMISSABLE_ATOM } from "../../atoms/sidebar";
-import { useDocsContext } from "../../contexts/docs-context/useDocsContext";
+import { useColors, useTheme } from "../../atoms/theme";
import { DocsMainContent } from "../../docs/DocsMainContent";
import { Sidebar } from "../../sidebar/Sidebar";
import { HeaderContainer } from "./HeaderContainer";
@@ -26,11 +25,11 @@ const DefaultDocsStyle = () => {
};
function UnmemoizedDefaultDocs(): ReactElement {
- const { colors } = useDocsContext();
+ const colors = useColors();
const layout = useAtomValue(DOCS_LAYOUT_ATOM);
const showHeader = useAtomValue(SHOW_HEADER_ATOM);
- const { resolvedTheme: theme = "light" } = useTheme();
- const isSidebarFixed = layout?.disableHeader || colors[theme as "light" | "dark"]?.sidebarBackground != null;
+ const theme = useTheme();
+ const isSidebarFixed = layout?.disableHeader || colors[theme]?.sidebarBackground != null;
const isSidebarDismissable = useAtomValue(SIDEBAR_DISMISSABLE_ATOM);
diff --git a/packages/ui/app/src/themes/default/HeaderContainer.tsx b/packages/ui/app/src/themes/default/HeaderContainer.tsx
index c8606a5c17..efff73c095 100644
--- a/packages/ui/app/src/themes/default/HeaderContainer.tsx
+++ b/packages/ui/app/src/themes/default/HeaderContainer.tsx
@@ -3,8 +3,8 @@ import { useAtomValue } from "jotai";
import { ReactElement, useCallback } from "react";
import { HAS_HORIZONTAL_TABS } from "../../atoms/layout";
import { useIsMobileSidebarOpen } from "../../atoms/sidebar";
+import { useColors } from "../../atoms/theme";
import { MOBILE_SIDEBAR_ENABLED_ATOM } from "../../atoms/viewport";
-import { useDocsContext } from "../../contexts/docs-context/useDocsContext";
import { BgImageGradient } from "../../docs/BgImageGradient";
import { Header } from "../../docs/Header";
import { HeaderTabs } from "../../docs/HeaderTabs";
@@ -15,7 +15,7 @@ interface HeaderContainerProps {
}
export function HeaderContainer({ className }: HeaderContainerProps): ReactElement {
- const { colors } = useDocsContext();
+ const colors = useColors();
const showHeaderTabs = useAtomValue(HAS_HORIZONTAL_TABS);
const isScrolled = useIsScrolled();
const isMobileSidebarEnabled = useAtomValue(MOBILE_SIDEBAR_ENABLED_ATOM);
diff --git a/packages/ui/local-preview-bundle/package.json b/packages/ui/local-preview-bundle/package.json
index ba99a00b0b..46b51a84ef 100644
--- a/packages/ui/local-preview-bundle/package.json
+++ b/packages/ui/local-preview-bundle/package.json
@@ -38,7 +38,6 @@
"@fern-ui/components": "workspace:*",
"@fern-ui/core-utils": "workspace:*",
"@fern-ui/fdr-utils": "workspace:*",
- "@fern-ui/react-commons": "workspace:*",
"@fern-ui/ui": "workspace:*",
"cssnano": "^6.0.3",
"jsonpath": "^1.1.1",
diff --git a/packages/ui/local-preview-bundle/src/pages/[[...slug]].tsx b/packages/ui/local-preview-bundle/src/pages/[[...slug]].tsx
index 62ea23d385..2f1f92f51d 100644
--- a/packages/ui/local-preview-bundle/src/pages/[[...slug]].tsx
+++ b/packages/ui/local-preview-bundle/src/pages/[[...slug]].tsx
@@ -1,7 +1,6 @@
import type { DocsV2Read } from "@fern-api/fdr-sdk";
import { toast } from "@fern-ui/components";
-import { useDeepCompareEffect } from "@fern-ui/react-commons";
-import { DocsPage, useSetThemeColors } from "@fern-ui/ui";
+import { DocsPage } from "@fern-ui/ui";
import { useRouter } from "next/router";
import { ReactElement, useEffect, useRef, useState } from "react";
import ReconnectingWebSocket from "../utils/ReconnectingWebsocket";
@@ -131,11 +130,6 @@ export default function LocalPreviewDocs(): ReactElement {
};
}, [docs, router]);
- const setThemeColors = useSetThemeColors();
- useDeepCompareEffect(() => {
- setThemeColors(docsProps?.colors);
- }, [docsProps?.colors]);
-
if (docsProps == null) {
return <>>;
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 010651ce97..e0399424d9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1202,9 +1202,6 @@ importers:
next-mdx-remote:
specifier: ^5.0.0
version: 5.0.0(@types/react@18.3.1)(react@18.3.1)
- next-themes:
- specifier: ^0.3.0
- version: 0.3.0(react-dom@18.3.1)(react@18.3.1)
nprogress:
specifier: ^0.2.0
version: 0.2.0
@@ -2020,9 +2017,6 @@ importers:
'@fern-ui/fdr-utils':
specifier: workspace:*
version: link:../../commons/fdr-utils
- '@fern-ui/react-commons':
- specifier: workspace:*
- version: link:../../commons/react/react-commons
'@fern-ui/ui':
specifier: workspace:*
version: link:../app
@@ -22479,16 +22473,6 @@ packages:
react: 18.3.1
dev: true
- /next-themes@0.3.0(react-dom@18.3.1)(react@18.3.1):
- resolution: {integrity: sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w==}
- peerDependencies:
- react: ^16.8 || ^17 || ^18
- react-dom: ^16.8 || ^17 || ^18
- dependencies:
- react: 18.3.1
- react-dom: 18.3.1(react@18.3.1)
- dev: false
-
/next-tick@1.1.0:
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}