Skip to content

Commit 45ef0d9

Browse files
authored
Merge pull request #12380 from ethereum/nav-delay
fix: nav item hover zone, opening delay duration
2 parents 1b075bc + 48ee6c7 commit 45ef0d9

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/components/Nav/Menu/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as NavigationMenu from "@radix-ui/react-navigation-menu"
44

55
import { Button } from "@/components/Buttons"
66

7-
import { SECTION_LABELS } from "@/lib/constants"
7+
import { NAV_PY, SECTION_LABELS } from "@/lib/constants"
88

99
import type { NavSections } from "../types"
1010

@@ -32,6 +32,7 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
3232
dir={direction}
3333
orientation="horizontal"
3434
onValueChange={handleSectionChange}
35+
delayDuration={0}
3536
>
3637
<NavigationMenu.List asChild>
3738
<UnorderedList display="flex" listStyleType="none" m="0">
@@ -47,6 +48,13 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
4748
variant="ghost"
4849
whiteSpace="nowrap"
4950
color={isActive ? "primary.base" : "body.base"}
51+
_after={{
52+
content: '""',
53+
position: "absolute",
54+
insetInline: 0,
55+
top: "100%",
56+
height: NAV_PY,
57+
}}
5058
>
5159
{/* Animated highlight for active section */}
5260
{isActive && (

src/components/Nav/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import LanguagePicker from "@/components/LanguagePicker"
2222
import { BaseLink } from "@/components/Link"
2323
import Search from "@/components/Search"
2424

25+
import { NAV_PY } from "@/lib/constants"
26+
2527
import Menu from "./Menu"
2628
import MobileNavMenu from "./Mobile"
2729
import { useNav } from "./useNav"
@@ -69,7 +71,7 @@ const Nav = () => {
6971
borderColor="rgba(0, 0, 0, 0.1)"
7072
height="4.75rem"
7173
justifyContent="center"
72-
py={4}
74+
py={NAV_PY}
7375
px={{ base: 4, xl: 8 }}
7476
>
7577
<Flex
@@ -94,7 +96,7 @@ const Nav = () => {
9496
ms={{ base: 3, xl: 8 }}
9597
>
9698
<Menu hideBelow="md" sections={linkSections} />
97-
<Flex alignItems="center"/* justifyContent="space-between" */>
99+
<Flex alignItems="center" /* justifyContent="space-between" */>
98100
<Search {...searchModalDisclosure} />
99101
{/* Desktop */}
100102
<HStack hideBelow="md" gap="0">

src/lib/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ export const SECTION_LABELS: NavSectionKey[] = [
8787
"participate",
8888
"research",
8989
]
90+
91+
export const NAV_PY = 4

0 commit comments

Comments
 (0)