Skip to content

Commit 8133fab

Browse files
authored
[TOOL-5083] Portal: Fix header on mobile viewport (#7661)
1 parent 37414eb commit 8133fab

File tree

4 files changed

+28
-32
lines changed

4 files changed

+28
-32
lines changed

apps/portal/src/app/Header.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
TableOfContentsIcon,
99
} from "lucide-react";
1010
import Link from "next/link";
11-
import { usePathname, useRouter } from "next/navigation";
11+
import { usePathname } from "next/navigation";
1212
import { useState } from "react";
1313
import { DocSearch } from "@/components/others/DocSearch";
1414
import { Button } from "@/components/ui/button";
@@ -191,13 +191,12 @@ const supportLinks = [
191191

192192
export function Header() {
193193
const [showBurgerMenu, setShowBurgerMenu] = useState(false);
194-
const router = useRouter();
195194
const pathname = usePathname();
196195

197196
return (
198-
<header className="flex w-full flex-col gap-2 border-b bg-background pt-4 px-4 lg:px-8 overflow-hidden">
197+
<header className="flex w-full flex-col gap-2 border-b bg-background pt-4 px-4 pb-4 xl:pb-0 lg:px-8 overflow-hidden">
198+
{/* Top row */}
199199
<div className="container flex items-center justify-between gap-6">
200-
{/* Top row */}
201200
<div className="flex items-center gap-2">
202201
<Link
203202
aria-label="thirdweb Docs"
@@ -219,7 +218,7 @@ export function Header() {
219218
href="https://github.com/thirdweb-dev"
220219
target="_blank"
221220
>
222-
<GithubIcon className="mx-3 size-6" />
221+
<GithubIcon className="size-6 lg:size-5" />
223222
</Link>
224223
</div>
225224

@@ -232,25 +231,21 @@ export function Header() {
232231
</div>
233232

234233
<div className="hidden xl:block">
235-
<Button
236-
onClick={() => {
237-
router.push("/chat");
238-
}}
239-
>
240-
<MessageCircleIcon className="mr-2 size-4" />
241-
Ask AI
234+
<Button asChild>
235+
<Link href="/chat">
236+
<MessageCircleIcon className="mr-2 size-4" />
237+
Ask AI
238+
</Link>
242239
</Button>
243240
</div>
244241

245242
<div className="flex items-center gap-1 xl:hidden">
246243
<ThemeSwitcher className="border-none bg-transparent" />
247244
<DocSearch variant="icon" />
248-
<Button
249-
className="p-2"
250-
onClick={() => router.push("/chat")}
251-
variant="ghost"
252-
>
253-
<MessageCircleIcon className="size-7" />
245+
<Button className="p-2" asChild variant="ghost">
246+
<Link href="/chat">
247+
<MessageCircleIcon className="size-6" />
248+
</Link>
254249
</Button>
255250
<Button
256251
className="p-2"
@@ -264,13 +259,13 @@ export function Header() {
264259
</div>
265260

266261
{/* Bottom row - hidden on mobile */}
267-
<div className="container hidden items-center justify-between gap-6 xl:flex">
262+
<div className="container hidden items-center justify-between gap-6 xl:flex mt-1">
268263
<nav className="flex grow gap-5">
269-
<ul className="flex flex-row items-center gap-5">
264+
<ul className="flex flex-row items-center gap-0 mb-1">
270265
{links.map((link) => {
271266
return (
272267
<li
273-
className="flex items-center py-4 relative overflow-hidden"
268+
className="flex items-center py-2 relative px-2.5 rounded-lg hover:bg-accent hover:text-foreground"
274269
key={link.href}
275270
onClick={() => {
276271
setShowBurgerMenu(false);
@@ -281,7 +276,7 @@ export function Header() {
281276
>
282277
<NavLink href={link.href} name={link.name} />
283278
{pathname.includes(link.href) && (
284-
<div className="bg-violet-700 h-1 inset-x-0.5 rounded-full absolute -bottom-0.5" />
279+
<div className="bg-violet-700 h-[2px] inset-x-0 rounded-full absolute -bottom-1" />
285280
)}
286281
</li>
287282
);

apps/portal/src/components/Layouts/DocLayout.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clsx from "clsx";
1+
import { cn } from "@/lib/utils";
22
import { PageFooter } from "../Document/PageFooter";
33
import {
44
DocSidebar,
@@ -25,17 +25,18 @@ type DocLayoutProps = {
2525
export function DocLayout(props: DocLayoutProps) {
2626
return (
2727
<div
28-
className={`container text-muted-foreground relative flex flex-col gap-12 xl:grid p-4 ${
28+
className={cn(
29+
"container text-muted-foreground relative flex flex-col gap-12 xl:grid",
2930
props.showTableOfContents !== false
3031
? "xl:grid-cols-[220px_720px_1fr]"
31-
: "xl:grid-cols-[220px_1160px]"
32-
}`}
32+
: "xl:grid-cols-[220px_1160px]",
33+
)}
3334
style={{
3435
minHeight: "calc(100vh - var(--sticky-top-height))",
3536
}}
3637
>
3738
<aside
38-
className={clsx(
39+
className={cn(
3940
"sticky top-sticky-top-height h-sidebar-height flex-col overflow-y-hidden",
4041
"hidden xl:flex",
4142
)}

apps/portal/src/components/others/DocSearch.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,11 @@ export function DocSearch(props: { variant: "icon" | "search" }) {
354354
{forDesktop && (
355355
<DialogTrigger asChild>
356356
<Button
357-
className="flex w-64 justify-between gap-6 px-3 text-muted-foreground"
357+
className="flex w-64 justify-between gap-6 px-3 text-muted-foreground bg-card"
358358
variant="outline"
359359
>
360-
Search Docs
361-
<div className="flex items-center gap-1 rounded-sm border bg-background px-2 py-1 text-muted-foreground text-xs">
360+
<span className="text-xs">Search Docs</span>
361+
<div className="flex items-center gap-1 rounded-sm px-1 py-1 text-muted-foreground text-xs">
362362
<CommandIcon className="size-3" />K
363363
</div>
364364
</Button>

codecov.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ coverage:
1616
- "**/__generated__/**"
1717
- "**/contract/deployment/zksync/**"
1818
- "*/thirdweb/src/contract/deployment/zksync/zkDeployContract.ts"
19-
19+
2020

2121
github_checks:
2222
annotations: true
@@ -30,5 +30,5 @@ comment:
3030
require_changes: false # if true: only post the comment if coverage changes
3131
require_base: false # [yes :: must have a base report to post]
3232
require_head: true # [yes :: must have a head report to post]
33-
show_carryforward_flags: true
33+
show_carryforward_flags: true
3434
hide_comment_details: true #collapse all the "detailed info" for the PR comment

0 commit comments

Comments
 (0)