Skip to content

Commit 44980c1

Browse files
committed
fix welcome page logo flash in dark mode
Replace useColorMode() with ThemedImage so the logo uses CSS-based theme switching instead of waiting for React hydration.
1 parent 9502c4f commit 44980c1

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/pages/index.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
import Link from "@docusaurus/Link";
2-
import { useColorMode } from "@docusaurus/theme-common";
32
import useBaseUrl from "@docusaurus/useBaseUrl";
43
import HomepageFeatures from "@site/src/components/HomepageFeatures";
54
import Heading from "@theme/Heading";
65
import Layout from "@theme/Layout";
6+
import ThemedImage from "@theme/ThemedImage";
77
import { clsx } from "clsx";
88
import type { ReactNode } from "react";
99

1010
import styles from "./index.module.css";
1111

1212
function HomepageHeader() {
13-
const { colorMode } = useColorMode();
14-
const logoSrc = colorMode === "dark" ? "/img/tagoio-official-logo-white.svg" : "/img/tagoio-official-logo.svg";
1513
return (
1614
<header className={clsx("hero", styles.heroBanner)}>
1715
<div className="container">
1816
<div className={styles.brandRow}>
1917
<span className={styles.brandDoc}>Documentation</span>
20-
<img src={useBaseUrl(logoSrc)} alt="TagoIO" width={160} height={40} className={styles.brandLogo} />
18+
<ThemedImage
19+
sources={{
20+
light: useBaseUrl("/img/tagoio-official-logo.svg"),
21+
dark: useBaseUrl("/img/tagoio-official-logo-white.svg"),
22+
}}
23+
alt="TagoIO"
24+
width={160}
25+
height={40}
26+
className={styles.brandLogo}
27+
/>
2128
</div>
2229
<Heading as="h1" className="hero__title">
2330
Easy IoT. Powerful Outcomes.

0 commit comments

Comments
 (0)