Implemented ThemeSwitcher
This commit is contained in:
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>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user