Implemented ThemeSwitcher
This commit is contained in:
parent
596c180d9d
commit
a2058d56d5
19
src/app/components/themeswitcher.tsx
Normal file
19
src/app/components/themeswitcher.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
|
||||
export default function ThemeSwitcher(){
|
||||
const [theme, setTheme] = React.useState("dark");
|
||||
|
||||
React.useEffect(() => {document.body.setAttribute("data-theme", theme)});
|
||||
|
||||
return(
|
||||
<ul className="p-2 right-0 text-base-content">
|
||||
<li><a onClick={() => setTheme("light")}>Light</a></li>
|
||||
<li><a onClick={() => setTheme("dark")}>Dark</a></li>
|
||||
<li><a onClick={() => setTheme("synthwave")}>Synthwave</a></li>
|
||||
<li><a onClick={() => setTheme("cyberpunk")}>Cyberpunk</a></li>
|
||||
<li><a onClick={() => setTheme("valentine")}>Valentine</a></li>
|
||||
</ul>
|
||||
);
|
||||
}
|
@ -15,7 +15,7 @@ export default function RootLayout({
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<html lang="en" data-theme="winter">
|
||||
<html lang="en" data-theme="dark">
|
||||
<body className="bg-base-100 base-content flex flex-col h-screen">{children}</body>
|
||||
</html>
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
import BingoController from './components/bingocontroller.tsx'
|
||||
import ThemeSwitcher from './components/themeswitcher.tsx'
|
||||
|
||||
export default function Home(){
|
||||
return(
|
||||
@ -15,10 +16,7 @@ export default function Home(){
|
||||
<li>
|
||||
<details>
|
||||
<summary>Theme</summary>
|
||||
<ul>
|
||||
<li><a>Theme 1</a></li>
|
||||
<li><a>Theme 2</a></li>
|
||||
</ul>
|
||||
<ThemeSwitcher/>
|
||||
</details>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -7,7 +7,7 @@ const config: Config = {
|
||||
},
|
||||
plugins: [require("daisyui")],
|
||||
daisyui: {
|
||||
themes: ["synthwave"]
|
||||
themes: ["light", "dark", "synthwave", "cyberpunk", "valentine"]
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user