Skip to content

Commit d3513aa

Browse files
committed
refactor: extract <DropdownMenu />
1 parent 9eb2021 commit d3513aa

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

src/components/Header.tsx

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ function HeaderMenuItem({ children }: { children: React.ReactNode }) {
1010
);
1111
}
1212

13+
function DropdownMenu({ children }: { children: React.ReactNode }) {
14+
return (
15+
<div className="absolute right-0 top-full mt-2 w-56 bg-white rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 border border-gray-100">
16+
<div className="py-1">{children}</div>
17+
</div>
18+
);
19+
}
20+
1321
export function Header({ hasError }: { hasError?: boolean }) {
1422
return (
1523
<header className="flex-shrink-0 h-16 px-3 items-center flex w-full bg-teal-25 opacity-1 border-b-blue-200 border-b">
@@ -32,41 +40,38 @@ export function Header({ hasError }: { hasError?: boolean }) {
3240
<div className="flex items-center gap-4 mr-16">
3341
<div className="flex items-center relative group">
3442
<HeaderMenuItem>Certificates</HeaderMenuItem>
35-
<div className="absolute right-0 top-full mt-2 w-56 bg-white rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 border border-gray-100">
36-
<div className="py-1">
37-
<Link
38-
to="/certificates"
39-
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
40-
>
41-
Download
42-
</Link>
43-
<Link
44-
to="/certificates/security"
45-
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
46-
>
47-
Certificate Security
48-
</Link>
49-
</div>
50-
</div>
43+
<DropdownMenu>
44+
<Link
45+
to="/certificates"
46+
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
47+
>
48+
Download
49+
</Link>
50+
<Link
51+
to="/certificates/security"
52+
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
53+
>
54+
Certificate Security
55+
</Link>
56+
</DropdownMenu>
5157
</div>
5258
<div className="flex items-center relative group">
5359
<HeaderMenuItem>Help</HeaderMenuItem>
54-
<div className="absolute right-0 top-full mt-2 w-56 bg-white rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 border border-gray-100">
55-
<div className="py-1">
56-
<Link
57-
to="/help/continue-setup"
58-
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
59-
>
60-
Continue Setup
61-
</Link>
62-
<Link
63-
to="/help/copilot-setup"
64-
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
65-
>
66-
Copilot Setup
67-
</Link>
68-
</div>
69-
</div>
60+
61+
<DropdownMenu>
62+
<Link
63+
to="/help/continue-setup"
64+
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
65+
>
66+
Continue Setup
67+
</Link>
68+
<Link
69+
to="/help/copilot-setup"
70+
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
71+
>
72+
Copilot Setup
73+
</Link>
74+
</DropdownMenu>
7075
</div>
7176

7277
<div className="flex items-center relative group">

0 commit comments

Comments
 (0)