Skip to content

Commit 3e48e54

Browse files
committed
fix(navbar): fix scrolling behavior in mobile view
1 parent b6686a4 commit 3e48e54

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

client/src/components/Navbar/navbar.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export function Navbar() {
6565
}
6666
};
6767

68+
69+
6870
const handleGithubClick = (event: React.MouseEvent<HTMLButtonElement>) => {
6971
event.preventDefault();
7072
window.open("https://github.com/devhub-ai/devhub", "_blank");
@@ -82,9 +84,21 @@ export function Navbar() {
8284
/>
8385
</div>
8486
<div className="flex gap-4 md:hidden">
85-
<button onClick={(e) => handleClick(e, { to: "#features" })}><IconTerminal2 className="size-10" /></button>
86-
<button onClick={(e) => handleGithubClick(e)}><IconBrandGithub className="size-10" /></button>
87+
<button onClick={(e) => {
88+
e.preventDefault();
89+
const targetElement = document.querySelector("#features");
90+
if (targetElement) {
91+
targetElement.scrollIntoView({ behavior: "smooth" });
92+
}
93+
}}>
94+
<IconTerminal2 className="size-10" />
95+
</button>
96+
<button onClick={handleGithubClick}>
97+
<IconBrandGithub className="size-10" />
98+
</button>
8799
</div>
100+
101+
88102
<div className="px-4">
89103
<ModeToggle />
90104
</div>

0 commit comments

Comments
 (0)