-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add theme toggle add settings menu to navbar
- Loading branch information
Showing
10 changed files
with
166 additions
and
32 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
'use client'; | ||
|
||
import React, { ReactNode } from 'react'; | ||
import { ThemeProvider as TP } from 'next-themes'; | ||
|
||
interface ThemeProviderProps { | ||
children: ReactNode; | ||
} | ||
|
||
const ThemeProvider = ({ children }: ThemeProviderProps) => <TP attribute='class'>{children}</TP>; | ||
|
||
export default ThemeProvider; |
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,40 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import NavLink from '@/components/nav-link'; | ||
import ThemeToggle from '@/components/theme-toggle'; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from '@/components/ui/dialog'; | ||
|
||
import SettingsIcon from '@/assets/images/settings.png'; | ||
|
||
const Settings = () => { | ||
return ( | ||
<Dialog> | ||
<DialogTrigger asChild> | ||
<NavLink href='#settings' icon={SettingsIcon}> | ||
Settings | ||
</NavLink> | ||
</DialogTrigger> | ||
<DialogContent className='sm:max-w-[425px]'> | ||
<DialogHeader> | ||
<DialogTitle>collectionlog.net settings</DialogTitle> | ||
</DialogHeader> | ||
<div className='h-full p-2 shadow-log'> | ||
<div className='grid h-full grid-cols-5 items-center gap-2 border border-light p-2'> | ||
<p className='col-span-3 text-lg'>Theme color</p> | ||
<ThemeToggle className='col-span-2' /> | ||
</div> | ||
</div> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default Settings; |
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,58 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { Check, ChevronDown } from 'lucide-react'; | ||
import { useTheme } from 'next-themes'; | ||
|
||
import { Button } from '@/components/ui/button'; | ||
import { Command, CommandGroup, CommandItem } from '@/components/ui/command'; | ||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; | ||
import { cn, toTitleCase } from '@/lib/utils'; | ||
|
||
interface ThemeToggleProps { | ||
className?: string; | ||
} | ||
|
||
const ThemeToggle = ({ className }: ThemeToggleProps) => { | ||
const { theme, setTheme } = useTheme(); | ||
const themeValues = ['dark', 'light', 'system']; | ||
|
||
return ( | ||
<Popover> | ||
<PopoverTrigger asChild> | ||
<Button | ||
role='combobox' | ||
variant='combo' | ||
className={cn('w-full justify-between', className)} | ||
> | ||
{toTitleCase(theme!)} | ||
<ChevronDown className='ml-2 h-6 w-6 shrink-0' /> | ||
</Button> | ||
</PopoverTrigger> | ||
<PopoverContent className='w-full p-0'> | ||
<Command> | ||
<CommandGroup> | ||
{themeValues.map((value) => ( | ||
<CommandItem | ||
className='flex justify-between text-lg' | ||
key={value} | ||
value={value} | ||
onSelect={() => setTheme(value)} | ||
> | ||
{toTitleCase(value)} | ||
<Check | ||
className={cn( | ||
'ml-2 h-4 w-4', | ||
theme === value ? 'opacity-100' : 'opacity-0' | ||
)} | ||
/> | ||
</CommandItem> | ||
))} | ||
</CommandGroup> | ||
</Command> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default ThemeToggle; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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