Skip to content

Commit ecd1d7e

Browse files
committed
fix(Navbar): replaced deprecated overlay prop with menu in Dropdown component
1 parent 61c76db commit ecd1d7e

File tree

1 file changed

+74
-53
lines changed

1 file changed

+74
-53
lines changed

src/components/Navbar.tsx

+74-53
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import { useState } from "react";
2-
import { Menu, Dropdown, Button, Image, Grid } from "antd";
3-
import { useSpring, animated } from "react-spring";
4-
import { useLocation, Link } from "react-router-dom";
51
import {
2+
BookOutlined,
3+
CaretDownFilled,
64
GithubOutlined,
5+
InfoOutlined,
76
QuestionOutlined,
87
UserOutlined,
9-
InfoOutlined,
10-
BookOutlined,
11-
CaretDownFilled,
128
} from "@ant-design/icons";
9+
import type { MenuProps } from "antd";
10+
import { Button, Dropdown, Grid, Image } from "antd";
11+
import { useState } from "react";
12+
import { Link, useLocation } from "react-router-dom";
13+
import { animated, useSpring } from "react-spring";
1314
import ToggleDarkMode from "./ToggleDarkMode";
1415

1516
const { useBreakpoint } = Grid;
@@ -31,50 +32,70 @@ function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
3132
config: { duration: 1000 },
3233
});
3334

34-
const helpMenu = (
35-
<Menu>
36-
<Menu.ItemGroup title="Info">
37-
<Menu.Item key="about">
38-
<a
39-
href="https://github.com/accordproject/template-playground/blob/main/README.md"
40-
target="_blank"
41-
rel="noopener noreferrer"
42-
>
43-
<QuestionOutlined /> About
44-
</a>
45-
</Menu.Item>
46-
<Menu.Item key="community">
47-
<a
48-
href="https://discord.com/invite/Zm99SKhhtA"
49-
target="_blank"
50-
rel="noopener noreferrer"
51-
>
52-
<UserOutlined /> Community
53-
</a>
54-
</Menu.Item>
55-
<Menu.Item key="issues">
56-
<a
57-
href="https://github.com/accordproject/template-playground/issues"
58-
target="_blank"
59-
rel="noopener noreferrer"
60-
>
61-
<InfoOutlined /> Issues
62-
</a>
63-
</Menu.Item>
64-
</Menu.ItemGroup>
65-
<Menu.ItemGroup title="Documentation">
66-
<Menu.Item key="documentation">
67-
<a
68-
href="https://github.com/accordproject/template-engine/blob/main/README.md"
69-
target="_blank"
70-
rel="noopener noreferrer"
71-
>
72-
<BookOutlined /> Documentation
73-
</a>
74-
</Menu.Item>
75-
</Menu.ItemGroup>
76-
</Menu>
77-
);
35+
const helpMenu: MenuProps["items"] = [
36+
{
37+
key: "info",
38+
type: "group",
39+
label: "Info",
40+
children: [
41+
{
42+
key: "about",
43+
label: (
44+
<a
45+
href="https://github.com/accordproject/template-playground/blob/main/README.md"
46+
target="_blank"
47+
rel="noopener noreferrer"
48+
>
49+
<QuestionOutlined /> About
50+
</a>
51+
),
52+
},
53+
{
54+
key: "community",
55+
label: (
56+
<a
57+
href="https://discord.com/invite/Zm99SKhhtA"
58+
target="_blank"
59+
rel="noopener noreferrer"
60+
>
61+
<UserOutlined /> Community
62+
</a>
63+
),
64+
},
65+
{
66+
key: "issues",
67+
label: (
68+
<a
69+
href="https://github.com/accordproject/template-playground/issues"
70+
target="_blank"
71+
rel="noopener noreferrer"
72+
>
73+
<InfoOutlined /> Issues
74+
</a>
75+
),
76+
},
77+
],
78+
},
79+
{
80+
key: "documentation",
81+
type: "group",
82+
label: "Documentation",
83+
children: [
84+
{
85+
key: "documentation",
86+
label: (
87+
<a
88+
href="https://github.com/accordproject/template-engine/blob/main/README.md"
89+
target="_blank"
90+
rel="noopener noreferrer"
91+
>
92+
<BookOutlined /> Documentation
93+
</a>
94+
),
95+
},
96+
],
97+
},
98+
];
7899

79100
const menuItemStyle = (key: string, isLast: boolean) => ({
80101
display: "flex",
@@ -148,7 +169,7 @@ function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
148169
onMouseEnter={() => setHovered("help")}
149170
onMouseLeave={() => setHovered(null)}
150171
>
151-
<Dropdown overlay={helpMenu} trigger={["click"]}>
172+
<Dropdown menu={{ items: helpMenu }} trigger={["click"]}>
152173
<Button
153174
style={{
154175
background: "transparent",
@@ -254,4 +275,4 @@ function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
254275
);
255276
}
256277

257-
export default Navbar;
278+
export default Navbar;

0 commit comments

Comments
 (0)