Skip to content

Commit

Permalink
Fix dropdown placement of ChainSwitch on PC
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Apr 7, 2024
1 parent d21e66e commit e015280
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/chain-switch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getChainConfig, getChainConfigs, getChainLogoSrc } from "@/utils";
import {
FloatingPortal,
Placement,
offset,
useClick,
useDismiss,
Expand All @@ -14,9 +15,10 @@ import { useNetwork, useSwitchNetwork } from "wagmi";

const chainOptions = getChainConfigs();

export default function ChainSwitch() {
export default function ChainSwitch({ placement }: { placement?: Placement }) {
const [isOpen, setIsOpen] = useState(false);
const { refs, context, floatingStyles } = useFloating({
placement,
open: isOpen,
onOpenChange: setIsOpen,
middleware: [offset(6)],
Expand Down
2 changes: 1 addition & 1 deletion src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function Header() {
<div className="hidden items-center gap-medium lg:flex">
<HistoryNav />
<User prefixLength={14} suffixLength={10} />
<ChainSwitch />
<ChainSwitch placement="bottom-end" />
</div>
<Image
width={24}
Expand Down

0 comments on commit e015280

Please sign in to comment.