-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move theme toggler to its own component
- Loading branch information
1 parent
b6716be
commit a0863fa
Showing
2 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Theme, useTheme} from '@/providers/ThemeProvider'; | ||
import {LuMoon, LuSun} from 'react-icons/lu'; | ||
import React from 'react'; | ||
import {Button} from '@nextui-org/button'; | ||
import {Tooltip} from '@nextui-org/tooltip'; | ||
|
||
export const ThemeToggleButton = () => { | ||
const { theme, toggleTheme } = useTheme(); | ||
return ( | ||
<Tooltip content={theme === Theme.Dark ? 'Bytt til lys modus' : 'Bytt til mørk modus'}> | ||
<Button isIconOnly variant="light" onClick={toggleTheme} className="p-2"> | ||
{theme === Theme.Dark ? <LuSun size={24}/> : <LuMoon size={24}/>} | ||
</Button> | ||
</Tooltip> | ||
); | ||
}; |