diff --git a/src/App.tsx b/src/App.tsx index f1086d8..042454d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,6 +6,7 @@ import VerticalMenu from "./components/VerticalMenu" import HorizontalMenu from "./components/HorizontalMenu" import ContentRenderer from "./components/ContentRenderer" import Footer from "./components/Footer" +import { ThemeProvider, ThemeSwitcher } from "./components/Theme" import { useState, useEffect } from 'react'; @@ -58,36 +59,43 @@ export default function App() { return ( -
- -
-
-
-
- + + <> +
+
-
- -
-
-
-
- +
+
+
+ +
-
- -
-
- -
-
+ +
+
+
+
+ +
+
+ +
+
+ +
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+ +
+ + ) } diff --git a/src/components/Card.tsx b/src/components/Card.tsx index e97fd05..35b2d9e 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -54,41 +54,41 @@ export default function Card() {
-

+

{np && np.isPlaying &&

-
+
- {np.artist} + {np.artist}

{np.title}

}

-
+

- {" "} + {" "} i@yude.jp

- {" "} + {" "} +81 70-8909-1949

- {" "} + {" "} @yude_jp

- {" "} + {" "} yude

- {" "} + {" "} yude

diff --git a/src/components/Chat.tsx b/src/components/Chat.tsx index 9f228d2..990b74d 100644 --- a/src/components/Chat.tsx +++ b/src/components/Chat.tsx @@ -91,23 +91,23 @@ export default function Chat() {
-
-
+ ) +} + +export const ThemeProvider = ({ children }: Props): JSX.Element => { + const setTheme = useSetTheme(); + + useEffect(() => { + const root = window.document.documentElement; + + if (window.localStorage.getItem("theme")) { + root.setAttribute("data-theme", window.localStorage.getItem("theme") || (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light")); + setTheme(window.localStorage.getItem("theme") as Theme); + } else { + const initialColorValue = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light"; + root.setAttribute("data-theme", initialColorValue); + setTheme(initialColorValue as Theme); + window.localStorage.setItem("theme", initialColorValue); + } + }, [setTheme]); + + return ( + <> +