Skip to content

Commit

Permalink
move themeswitcher to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshj01 committed Oct 7, 2024
1 parent fbff425 commit c963834
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion public/sw.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/app/(main)/_components/PSNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
NavbarContent
} from "@nextui-org/navbar";
import Image from 'next/image';
import { useRouter } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
import { FiSidebar } from 'react-icons/fi';
import { useSidebar } from "../_hooks/useSidebar";
import IconButton from './IconButton';
Expand All @@ -18,7 +18,8 @@ interface PSNavbarProps {
const PSNavbar: React.FC<PSNavbarProps> = ({ sideBarIcon }) => {
const router = useRouter();
const { showSideBar, setShowSideBar, setId, setSelected } = useSidebar();

const pathName = usePathname();
const isPublishRoute = pathName.includes('/logs/publish');
return (
<Navbar
position='sticky'
Expand Down Expand Up @@ -60,7 +61,7 @@ const PSNavbar: React.FC<PSNavbarProps> = ({ sideBarIcon }) => {
</div>
</NavbarContent>
<NavbarContent justify="end">
<ThemeSwitcher />
{isPublishRoute && <ThemeSwitcher />}
</NavbarContent>
</Navbar>
)
Expand Down
6 changes: 5 additions & 1 deletion src/app/(main)/_components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import IconButton from "./IconButton";
import LoginMenu from './LoginMenu';
import ShortCutsGuide from './ShortcutsGuide';
import SidebarItem from './SideBarItem';
import { ThemeSwitcher } from './ThemeSwitcher';

const Sidebar: React.FC = () => {
const { id, setSelected, setId, showSideBar, user, setUser, setShowSideBar } = useSidebar();
Expand Down Expand Up @@ -143,7 +144,10 @@ const Sidebar: React.FC = () => {
)}
{/* <SettingsDialog /> */}
<div className='flex items-center justify-between bg-surface dark:bg-gray-700 border-t border-gray-300 dark:border-gray-600 px-2 py-2'>
<ShortCutsGuide />
<div className="flex items-center space-x-2">
<ShortCutsGuide />
<ThemeSwitcher />
</div>
<LoginMenu onLogOut={handleLogout} onLogin={handleLogin} loading={loading} onSettings={() => {
router.push('/settings');
}} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/_components/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function ThemeSwitcher() {
setTheme(theme == Theme.DARK ? 'light' : 'dark');
Analytics.logThemeChange(theme === 'dark' ? 'light' : 'dark');
}}>
{theme === 'dark' ? <SunIcon className='text-black size-12 dark:text-white' /> : <MoonIcon className='size-12 text-black dark:text-white' />}
{theme === 'dark' ? <SunIcon className='text-black size-7 dark:text-white' /> : <MoonIcon className='size-7 text-black dark:text-white' />}
</IconButton>
</div>
)
Expand Down

0 comments on commit c963834

Please sign in to comment.