mirror of
https://github.com/yude-jp/yude.jp
synced 2024-12-22 20:20:09 +09:00
Remove themeChanger
This commit is contained in:
parent
3375b48c6e
commit
c961e9e7aa
@ -2,7 +2,6 @@ import "tailwindcss/tailwind.css";
|
||||
import Popper from "popper.js";
|
||||
import Link from 'next/link';
|
||||
import LangSelector from "./LangSelector"
|
||||
import ThemeChanger from './themeChanger';
|
||||
|
||||
const Navbar = () => {
|
||||
return (
|
||||
@ -17,10 +16,8 @@ const Navbar = () => {
|
||||
</Link>
|
||||
<div className="origin-top-right absolute right-0">
|
||||
<LangSelector />
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
<ThemeChanger />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -1,29 +0,0 @@
|
||||
import "tailwindcss/tailwind.css";
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
const ThemeChanger = () => {
|
||||
const [mounted, setMounted] = useState(false)
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
// When mounted on client, now we can show the UI
|
||||
useEffect(() => setMounted(true), [])
|
||||
|
||||
if (!mounted) return null
|
||||
|
||||
return (
|
||||
<div className="p-8 bg-gray-200 flex justify-between items-center font-bold text-xl">
|
||||
The current theme is: {theme}
|
||||
<div>
|
||||
<button className="hover:text-orange-600" onClick={() => setTheme('light')}>
|
||||
<svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" /></svg>
|
||||
</button>
|
||||
<button className="ml-4 hover:text-orange-600" onClick={() => setTheme('dark')}>
|
||||
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" id="moon" class="w-8 h-8 text-cool-gray-800 dark:text-cool-gray-200 group-hover:text-purple-600 group-focus:text-purple-600 dark:group-hover:text-purple-50 dark:group-focus:text-purple-50"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ThemeChanger;
|
Loading…
Reference in New Issue
Block a user