tldraw/apps/docs/components/ThemeSwitcher.tsx

16 lines
320 B
TypeScript
Raw Normal View History

2023-04-25 11:01:25 +00:00
import { useTheme } from 'next-themes'
import { Icon } from './Icon'
export function ThemeSwitcher() {
const { theme, setTheme } = useTheme()
return (
<button
className="sidebar__button icon-button"
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
>
<Icon icon="light" />
</button>
)
}