Skip to content

Commit 75647ec

Browse files
authored
Merge pull request #179 from ethereum/nav
Fix Nav TODO comments
2 parents 4d1f0fc + 4a6ad65 commit 75647ec

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

src/components/Nav/Dropdown.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import { Box, Fade, Flex, Icon, ListItem } from "@chakra-ui/react"
44

55
import { BaseLink, type LinkProps } from "../Link"
66

7-
// TODO
8-
// import { useOnClickOutside } from "../../hooks/useOnClickOutside"
9-
// import { getDirection } from "../../utils/translations"
10-
// import { Lang } from "../../utils/languages"
117
import { ISection } from "./types"
128

9+
import { useOnClickOutside } from "@/hooks/useOnClickOutside"
10+
1311
const NavLink = (props: LinkProps) => (
1412
<BaseLink
1513
color="text200"
@@ -54,14 +52,12 @@ const NavDropdown: React.FC<IProps> & {
5452
} = ({ children, section, hasSubNav }) => {
5553
const [isOpen, setIsOpen] = useState(false)
5654

57-
// const { locale } = useRouter()
5855
const ref = createRef<HTMLLIElement>()
5956

6057
const toggle = () => setIsOpen((isOpen) => !isOpen)
6158
const close = () => setIsOpen(false)
6259

63-
// TODO
64-
// useOnClickOutside(ref, () => setIsOpen(false))
60+
useOnClickOutside(ref, () => setIsOpen(false))
6561

6662
// Toggle on `enter` key
6763
const onKeyDownHandler = (e: React.KeyboardEvent<HTMLElement>): void => {

src/components/Nav/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const Nav: FC<IProps> = ({ path }) => {
3838
<Flex
3939
ref={navWrapperRef}
4040
as="nav"
41-
// TODO
42-
// aria-label={t("nav-primary")}
41+
aria-label={t("nav-primary")}
4342
bg="background.base"
4443
borderBottom="1px"
4544
borderColor="rgba(0, 0, 0, 0.1)"
@@ -56,8 +55,7 @@ const Nav: FC<IProps> = ({ path }) => {
5655
>
5756
<BaseLink
5857
to="/"
59-
// TODO
60-
// aria-label={t("home")}
58+
aria-label={t("home")}
6159
display="inline-flex"
6260
alignItems="center"
6361
textDecor="none"
@@ -127,8 +125,7 @@ const Nav: FC<IProps> = ({ path }) => {
127125
{shouldShowSubNav && (
128126
<Flex
129127
as="nav"
130-
// TODO
131-
// aria-label={t("nav-developers")}
128+
aria-label={t("nav-developers")}
132129
display={{ base: "none", lg: "flex" }}
133130
bg="ednBackground"
134131
borderBottom="1px"

src/components/Nav/useNav.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { cloneDeep } from "lodash"
33
import { useTranslation } from "next-i18next"
44
import { useColorMode } from "@chakra-ui/react"
55

6-
import { IItem, ISections } from "./types"
6+
import { trackCustomEvent } from "@/lib/utils/matomo"
77

8-
// TODO: add trackCustomEvent when util is migrated
9-
// import { trackCustomEvent } from "../../utils/matomo"
8+
import { IItem, ISections } from "./types"
109

1110
export const useNav = ({ path }: { path: string }) => {
1211
const [isMenuOpen, setIsMenuOpen] = useState(false)
@@ -294,12 +293,11 @@ export const useNav = ({ path }: { path: string }) => {
294293

295294
const changeColorMode = () => {
296295
toggleColorMode()
297-
// TODO: add trackCustomEvent when util is migrated
298-
// trackCustomEvent({
299-
// eventCategory: "nav bar",
300-
// eventAction: "click",
301-
// eventName: isDarkTheme ? "light mode" : "dark mode", // This will be inverted as the state is changing
302-
// })
296+
trackCustomEvent({
297+
eventCategory: "nav bar",
298+
eventAction: "click",
299+
eventName: isDarkTheme ? "light mode" : "dark mode", // This will be inverted as the state is changing
300+
})
303301
}
304302

305303
const mobileNavProps = {

0 commit comments

Comments
 (0)