Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const config: Config = {
logo: {
alt: "recode hive Logo",
src: "img/logo.png",
srcDark: "img/logo-dark.png", // add: light-colored / white-background version for night mode
},
items: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/dashboard/Sidebar/DashboardSidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
border-right: 1px solid var(--ifm-color-emphasis-200);
background: var(--ifm-background-color);
transition: width 0.2s ease;
overflow: hidden;

}

.dashboard-rail.collapsed {
Expand Down Expand Up @@ -113,7 +113,7 @@
border-radius: 10px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
padding: 6px;
z-index: 20;
z-index: 1000;
display: flex;
flex-direction: column;
}
Expand Down
29 changes: 6 additions & 23 deletions src/theme/ColorModeToggle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
import React from "react";
import { useSafeColorMode } from "@site/src/utils/useSafeColorMode";
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
import { useColorMode } from "@docusaurus/theme-common";

export default function ColorModeToggle(): JSX.Element {
const { colorMode } = useSafeColorMode();

// Safe setColorMode that works with DOM
const setColorMode = (mode: "light" | "dark") => {
if (!ExecutionEnvironment.canUseDOM) return;
// Set DOM attribute immediately for instant visual feedback
document.documentElement.setAttribute("data-theme", mode);
// Also store in localStorage
localStorage.setItem("theme", mode);
// Trigger Docusaurus's internal theme change if available
try {
const {
setColorMode: docusaurusSetColorMode,
} = require("@docusaurus/theme-common");
docusaurusSetColorMode(mode);
} catch (e) {
// Fallback: just set the DOM attribute
}
};
const { colorMode, setColorMode } = useColorMode();

const toggleColorMode = () => {
const newMode = colorMode === "dark" ? "light" : "dark";
// Only use Docusaurus's setColorMode - it handles everything properly
// Use Docusaurus's real setColorMode - this updates the actual
// ColorModeProvider context, which drives ThemedImage (navbar logo),
// data-theme attribute, and localStorage all in one call.
setColorMode(newMode);
};

Expand Down Expand Up @@ -93,4 +76,4 @@ export default function ColorModeToggle(): JSX.Element {
</div>
</button>
);
}
}
2 changes: 1 addition & 1 deletion src/theme/Footer/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function FooterLayout(): ReactNode {
<span>code second.</span>
</p>
<div className="rh-footer__cta">
<Link to="/blog" className="rh-btn rh-btn--white">
<Link to="/blogs" className="rh-btn rh-btn--white">
<svg
className="rh-btn__icon"
width="16"
Expand Down
Binary file added static/img/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading