mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
32 lines
677 B
TypeScript
32 lines
677 B
TypeScript
'use client';
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
import { useTheme } from 'next-themes';
|
|
import { Button } from '@nextui-org/react';
|
|
|
|
function ThemeSwitcher() {
|
|
const [ mounted, setMounted ] = useState(false);
|
|
const { setTheme } = useTheme();
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
if (!mounted) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<Button onClick={ () => {
|
|
setTheme('light');
|
|
} }>Light Mode</Button>
|
|
<Button onClick={ () => {
|
|
setTheme('dark');
|
|
} }>Dark Mode</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ThemeSwitcher;
|