Skip to content

Commit

Permalink
chore(index): supports themed images
Browse files Browse the repository at this point in the history
  • Loading branch information
HsiangNianian authored Sep 12, 2024
1 parent 2809286 commit 3ec0863
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from "@docusaurus/Link";
import { useColorMode } from "@docusaurus/theme-common";
// import useBaseUrl from '@docusaurus/useBaseUrl';
import ThemedImage from '@theme/ThemedImage';
import Translate from "@docusaurus/Translate";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
Expand Down Expand Up @@ -100,8 +101,6 @@ function HomepageHeader() {


const HomeBaseContent = () => {
const { colorMode } = useColorMode();

const mainContent = React.useMemo(() => {
return (
<main className="mb-20 my-10 max-w-7xl mx-auto w-full px-4 sm:px-6 lg:px-8max-w-6xl">
Expand All @@ -112,21 +111,16 @@ const HomeBaseContent = () => {
);
}, []);

if (colorMode === "dark") {
return (
<>
<StarrySky />
{mainContent}
</>
);
} else {
return (
<>
<AuroraBackground />
<ThemedImage sources={{
light: <StarrySky />,
dark: <AuroraBackground />,
}}
/>
{mainContent}
</>
);
}
};


Expand Down

0 comments on commit 3ec0863

Please sign in to comment.