Skip to content

Commit

Permalink
Refactor select-theme.js component
Browse files Browse the repository at this point in the history
  • Loading branch information
JJozef committed Mar 15, 2024
1 parent b7a0249 commit 6c3014f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/components/select-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ import { Button } from './ui/button'
export function SelectTheme() {
const { theme, setTheme } = useTheme()

const handleTheme = () => {
if (theme === 'dark') {
setTheme('light')
} else {
setTheme('dark')
}
}

return (
<Button variant='outline' className='w-9 px-3' onClick={handleTheme}>
<Button
variant='outline'
className='w-9 px-3'
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
>
{theme === 'dark' ? (
<SunIcon className='h-4 w-4 min-w-4' />
) : (
Expand Down

0 comments on commit 6c3014f

Please sign in to comment.