Skip to content

Commit b610317

Browse files
committed
refactor: extract <DropdownMenuItem />
1 parent d3513aa commit b610317

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/components/Header.tsx

+21-21
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ function DropdownMenu({ children }: { children: React.ReactNode }) {
1818
);
1919
}
2020

21+
function DropdownMenuItem({
22+
children,
23+
to,
24+
}: {
25+
to: string;
26+
children: React.ReactNode;
27+
}) {
28+
return (
29+
<Link to={to} className="block px-5 py-3 text-gray-700 hover:bg-blue-50">
30+
{children}
31+
</Link>
32+
);
33+
}
34+
2135
export function Header({ hasError }: { hasError?: boolean }) {
2236
return (
2337
<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">
@@ -41,36 +55,22 @@ export function Header({ hasError }: { hasError?: boolean }) {
4155
<div className="flex items-center relative group">
4256
<HeaderMenuItem>Certificates</HeaderMenuItem>
4357
<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-
>
58+
<DropdownMenuItem to="/certificates">Download</DropdownMenuItem>
59+
<DropdownMenuItem to="/certificates/security">
5460
Certificate Security
55-
</Link>
61+
</DropdownMenuItem>
5662
</DropdownMenu>
5763
</div>
5864
<div className="flex items-center relative group">
5965
<HeaderMenuItem>Help</HeaderMenuItem>
6066

6167
<DropdownMenu>
62-
<Link
63-
to="/help/continue-setup"
64-
className="block px-5 py-3 text-gray-700 hover:bg-blue-50"
65-
>
68+
<DropdownMenuItem to="/help/continue-setup">
6669
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-
>
70+
</DropdownMenuItem>
71+
<DropdownMenuItem to="/help/copilot-setup">
7272
Copilot Setup
73-
</Link>
73+
</DropdownMenuItem>
7474
</DropdownMenu>
7575
</div>
7676

0 commit comments

Comments
 (0)