Skip to content

Commit

Permalink
Fixed navbar on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Oct 22, 2024
1 parent cd7a3d5 commit 2cb2f05
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 0 additions & 5 deletions packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { SwitchTheme } from "./SwitchTheme";
import { PunkConnectButton } from "./punk-society/BasedConnectButton";
import { ConfigMenu } from "./punk-society/ConfigMenu";
import { FaucetButton } from "./scaffold-eth";
Expand All @@ -20,7 +19,6 @@ export const Header = () => {
<div className="flex lg:sticky top-0 navbar bg-base-100 min-h-0 flex-shrink-0 justify-between z-20 px-0 sm:px-2">
<div className="navbar-start ml-4 lg:ml-2">
<div className="flex lg:hidden">
<SwitchTheme />
<div className="flex justify-center items-center ml-8 lg:ml-0">
<Link href="/" passHref>
<span className="inline-flex items-center gap-2">
Expand Down Expand Up @@ -130,9 +128,6 @@ export const Header = () => {
<div className="">
<ConfigMenu />
</div>
<div className="hidden lg:flex ">
<SwitchTheme />
</div>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions packages/nextjs/components/SwitchTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export const SwitchTheme = ({ className }: { className?: string }) => {
if (!mounted) return null;

return (
<div className={`flex space-x-2 h-8 items-center justify-center text-sm ${className}`}>
<button onClick={handleToggle} className="swap swap-rotate">
<div className={`flex space-x-2 h-8 items-center justify-start w-full ml-3 text-sm ${className}`}>
<button onClick={handleToggle} className="swap swap-rotate flex flex-row gap-2 justify-start items-center">
{isDarkMode ? <MoonIcon className="h-5 w-5" /> : <SunIcon className="h-5 w-5" />}
<span>Switch theme</span>
</button>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
QrCodeIcon,
} from "@heroicons/react/24/outline";
import { LanguageIcon } from "@heroicons/react/24/solid";
import { SwitchTheme } from "~~/components/SwitchTheme";
import { useOutsideClick } from "~~/hooks/scaffold-eth";
import { getTargetNetworks } from "~~/utils/scaffold-eth";

Expand Down Expand Up @@ -48,7 +49,9 @@ export const AddressInfoDropdown = ({ blockExplorerAddressLink }: AddressInfoDro
className="dropdown-content menu z-[2] p-2 mt-2 shadow-center shadow-accent bg-base-200 rounded-box gap-1"
>
<NetworkOptions hidden={!selectingNetwork} />

<div className="hidden lg:flex items-center justify-center ">
<SwitchTheme />
</div>
<li className={selectingNetwork ? "hidden" : ""}>
<label
htmlFor="qrcode-modal"
Expand Down

0 comments on commit 2cb2f05

Please sign in to comment.