Skip to content

Commit

Permalink
sync: Updates from docusaurus-template
Browse files Browse the repository at this point in the history
  • Loading branch information
writedocs-integration committed Dec 23, 2024
1 parent da24c55 commit a7ebe2b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/theme/Logo/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState, useEffect } from "react";
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
Expand Down Expand Up @@ -44,21 +44,25 @@ export default function Logo(props) {
// Use logo alt text if provided (including empty string),
// and provide a sensible fallback otherwise.
const alt = logo?.alt ?? fallbackAlt;

const hasHomepage =
configurations.homepage.endsWith(".html") ||
configurations.homepage.endsWith(".jsx") ||
configurations.homepage.endsWith(".js");

configurations.homepage.endsWith(".html") ||
configurations.homepage.endsWith(".jsx") ||
configurations.homepage.endsWith(".js");


const { colorMode } = useColorMode();
const [imageSrc, setImageSrc] = useState(logo);

const srcDark = {
...logo,
src: configurations.images.darkLogo
}

const imageSrc = colorMode === "dark" && srcDark.src ? srcDark : logo;

useEffect(() => {
setImageSrc(colorMode === "dark" && srcDark.src ? srcDark : logo);
}, [colorMode])

if (configurations.homepage && hasHomepage) {
return (
<Link
Expand Down

0 comments on commit a7ebe2b

Please sign in to comment.