Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav menu - redesign implementation #12125

Merged
merged 138 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 137 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
9be3ce6
style: add menu semantic tokens
wackerow Jan 17, 2024
32fbf6d
refactor: update nav item architecture
wackerow Jan 17, 2024
c91dac5
refactor: update Nav with new useNav, rm subnav
wackerow Jan 17, 2024
372bb3f
refactor: initialize mobile nav updates
wackerow Jan 17, 2024
39627f9
refactor: new Menu design using Popover
wackerow Jan 17, 2024
6bf6dbb
fix: pass direction to Chakra theme provider
wackerow Jan 15, 2024
9fa3f37
refactor: extract reusable MenuButton component
wackerow Jan 17, 2024
aaf7bb1
style: add bold font-weight to button label
wackerow Jan 17, 2024
76265b1
style: remove expand chevron
wackerow Jan 17, 2024
289886c
style: implement partiallyActive and hover styles
wackerow Jan 17, 2024
2725369
feat: implement menu icons
wackerow Jan 17, 2024
dcdffdc
refactor: extract section labels to constants
wackerow Jan 18, 2024
c70a82c
feat: initial draft of mobile menu
wackerow Jan 18, 2024
3e070ec
fix: lvl4 items, allowToggle, linting
wackerow Jan 18, 2024
ec76681
fix: hide hamburger on desktop
wackerow Jan 18, 2024
d4f651e
style: remove hover, wrap buttons
wackerow Jan 18, 2024
0f38a19
refactor: extract reusable Level type
wackerow Jan 18, 2024
55d4528
refactor: extract reusable LvlAccordion
wackerow Jan 18, 2024
e5024c0
fix: apply 'modal' zIndex to search modal
wackerow Jan 19, 2024
7e59a80
style: change isPartiallyActive to highContrast
wackerow Jan 19, 2024
07ec669
fix: hiding logic for desktop and mobile
wackerow Jan 20, 2024
ac2f3c5
style: display mobile menu below md breakpoint
wackerow Jan 20, 2024
9f27996
style: add box styles per design
wackerow Jan 20, 2024
db0016a
style: add auto-scroll to menu grid
wackerow Jan 21, 2024
84465a4
fix: isActive styling, add cleanPath util
wackerow Jan 21, 2024
af2f57d
style: animate active section bg with layoutId
wackerow Jan 22, 2024
5534be5
style: improve logic for minW of menu section
wackerow Jan 22, 2024
c947331
style: improve hover animations, tablet sizes
wackerow Jan 22, 2024
43cbc2f
fix: mobile RTL alignment
wackerow Jan 22, 2024
61891d5
fix: layout shift for nav icons
wackerow Jan 22, 2024
0103da0
Merge branch 'dev' into nav-menu
wackerow Jan 22, 2024
696c219
Merge branch 'dev' into nav-menu
wackerow Jan 25, 2024
28d7477
build: yarn add @ark-ui/react
wackerow Jan 29, 2024
f8f39d3
build: updates types, add LvlRefs
wackerow Jan 30, 2024
0ae9794
feat: initial draft of ark-ui nav menu
wackerow Jan 30, 2024
34937e3
refactor: enable highlighting, clean up
wackerow Jan 30, 2024
5e5609d
Merge branch 'dev' into nav-menu-ark-ui
wackerow Jan 30, 2024
edd6b18
fix: resolve type compilation
wackerow Jan 30, 2024
f7d8f96
chore: clean up tokens and types
wackerow Jan 30, 2024
cc35370
style: implement more styling for nav menu
wackerow Jan 30, 2024
30cba6c
build: exclude ark-ui and zag-js from netlifty
wackerow Jan 30, 2024
5648945
fix: rtl menu navigation
wackerow Jan 31, 2024
08998df
debug: tighten netlify.toml inclusion
wackerow Jan 31, 2024
948a4b9
refactor: extract individual menu components
wackerow Jan 31, 2024
26b1eae
fix: rm unmountOnExit to allow links to be followed
wackerow Jan 31, 2024
7c5bbb4
refactor: rename component to ItemContent
wackerow Jan 31, 2024
2cc5537
chore: rm unused data-group
wackerow Feb 1, 2024
98a2f89
i18n: extract JSON strings
wackerow Feb 1, 2024
fe8c1f2
Merge branch 'dev' into nav-menu-ark-ui
wackerow Feb 1, 2024
dd6fa80
refactor: rename Menu component
wackerow Feb 1, 2024
806a504
build: netlify ignore @swc/core-linux-x64-gnu
wackerow Feb 1, 2024
ee218db
Merge branch 'dev' into nav-menu-ark-ui
wackerow Feb 1, 2024
53a8759
build: rm zag-js and ark-ui from netlify ignore
wackerow Feb 1, 2024
772e7f7
refactor: clean up ItemContent
wackerow Feb 1, 2024
c8cf3db
refactor: use Ark prefix for Ark-UI components
wackerow Feb 1, 2024
63d8f35
fix: follow links with keyboard "enter"
wackerow Feb 1, 2024
0bb753e
chore: hooks first, rm unused
wackerow Feb 1, 2024
b7ae385
feat: update mobile menu close button
wackerow Feb 2, 2024
3c1b173
Merge branch 'dev' into nav-menu-ark-ui
wackerow Feb 2, 2024
5d5f9b0
docs: add function comment
wackerow Feb 2, 2024
186460a
style: update spacing token
wackerow Feb 2, 2024
229f662
fix: intl string key typo
wackerow Feb 3, 2024
12eac19
build: yarn add @radix-ui/react-navigation-menu
wackerow Feb 6, 2024
4a8739a
feat: template radix-ui nav menu
wackerow Feb 6, 2024
0027ec9
refactor: extract recursive LvlContent
wackerow Feb 6, 2024
756cb69
feat: update item styling
wackerow Feb 6, 2024
82921b7
fix: NavMenuProps to accept BoxProps
wackerow Feb 6, 2024
ff3b7f2
chore: remove @ark-ui/react
wackerow Feb 6, 2024
782359f
feat: update styling
wackerow Feb 7, 2024
299f9f8
fix: margin-inline-end on submenu list items
wackerow Feb 7, 2024
5a292a8
new icons
nloureiro Feb 7, 2024
60c4e17
fix: import order
wackerow Feb 7, 2024
e8de8a6
fix: Link import
wackerow Feb 7, 2024
e65fda7
trying to keep the same width on md break point
nloureiro Feb 7, 2024
df57cc5
Merge branch 'nav-menu-radix-ui' of https://github.com/ethereum/ether…
nloureiro Feb 7, 2024
a5cf666
Revert "trying to keep the same width on md break point"
wackerow Feb 7, 2024
7f874a2
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 7, 2024
f99df64
fix: consistent mobile breakpoint for nav bar
wackerow Feb 7, 2024
dbab886
style: adjust spacing
wackerow Feb 7, 2024
5f45dda
fix: grid columns
wackerow Feb 7, 2024
8808403
feat: add Ethereum icon for menu
wackerow Feb 7, 2024
488bb0d
fix: lvl height, last item mb
wackerow Feb 7, 2024
7422634
changed the main color for the language
nloureiro Feb 8, 2024
fb1645d
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 8, 2024
e604378
fix: nested menu kbd escape
wackerow Feb 8, 2024
006b487
chore: clean up Nav/Mobile
wackerow Feb 8, 2024
692a98b
refactor: rm menu tokens, replace with hook
wackerow Feb 8, 2024
b133f16
feat: add matomo tracking for desktop nav
wackerow Feb 8, 2024
9a27db1
refactor: explode into individual components
wackerow Feb 8, 2024
05022b6
feat: add matomo tracking to mobile nav menu
wackerow Feb 9, 2024
6ec20cf
fix: top nav spacing
wackerow Feb 9, 2024
a30e5da
feat: add fade animation
wackerow Feb 14, 2024
642147a
fix: focus moves with hover
wackerow Feb 14, 2024
8a0ba9b
chore: clean up, comment
wackerow Feb 14, 2024
3c4af58
refactor
pettinarip Feb 14, 2024
c2cc1f8
feat: update matomo tracking for nav menu
wackerow Feb 14, 2024
17148c4
fix: desktop activeSection typing
wackerow Feb 14, 2024
844f59f
feat: update matomo tracking for mobile nav menu
wackerow Feb 14, 2024
eef51d0
feat: update matomo tracking for mobile nav menu
wackerow Feb 14, 2024
c310f6c
horizontal nav using grids
pettinarip Feb 14, 2024
4960fa7
migrate column colors
pettinarip Feb 15, 2024
9a845cd
remove gridarea prop
pettinarip Feb 15, 2024
ef4edea
chore: add new menu item string
wackerow Feb 15, 2024
57713e7
fix: typo
wackerow Feb 15, 2024
0ee0773
Merge branch 'menu-wo-portal' into nav-menu-radix-ui
wackerow Feb 15, 2024
4c06783
feat: add /guides/ home link
wackerow Feb 15, 2024
e6cbeb8
fix: active page link styling
wackerow Feb 15, 2024
da09b8d
refactor: extract logic for readability
wackerow Feb 15, 2024
98a8265
chore: update matomo action string
wackerow Feb 15, 2024
f44c73e
fix: add roundedStart to open item
wackerow Feb 15, 2024
7d5b3c2
chore: rm old, add comment
wackerow Feb 16, 2024
4b53072
feat: add active link styling to mobile menu
wackerow Feb 16, 2024
31afc6c
feat: add roadmap overview link
wackerow Feb 16, 2024
d392a7c
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 16, 2024
300ce2f
design: adjust menu padding
wackerow Feb 16, 2024
68e257b
chore: rm trailing slashes
wackerow Feb 16, 2024
c4a749a
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 17, 2024
e05c72a
feat: add desktop nav menu animations
wackerow Feb 17, 2024
b7f7c0b
refactor: extract component logic to hook
wackerow Feb 17, 2024
a2964e2
Merge branch 'nav-menu-radix-ui' into menu-animations
wackerow Feb 17, 2024
7f1cc7b
refactor: LvlContent -> SubMenu, extract hook
wackerow Feb 17, 2024
7751d3d
chore: clean up hooks, rm active sub tracking
wackerow Feb 17, 2024
0b3dd4d
chore: adjust initial scaleX
wackerow Feb 17, 2024
77dcf7e
copy: update labels for defi, nfts, daos
wackerow Feb 18, 2024
1bddfc3
chore: remove unused AnimatePresence
wackerow Feb 18, 2024
ddfaf99
Merge pull request #12224 from ethereum/menu-animations
wackerow Feb 18, 2024
94f6d65
Merge branch 'nav-menu-radix-ui' of https://github.com/ethereum/ether…
wackerow Feb 18, 2024
daa13ad
chore: apply suggestions from code review
wackerow Feb 19, 2024
0194755
intl: update menu string with acronym first
wackerow Feb 19, 2024
6c006df
intl: update dapps label with acronym first
wackerow Feb 20, 2024
1899364
intl: import common.json bundle
wackerow Feb 20, 2024
2bdc886
i18n: import latest common.json from Crowdin
wackerow Feb 22, 2024
053ad58
i18n: import latest common.json from Crowdin
wackerow Feb 22, 2024
8550e55
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 22, 2024
47ff3fb
i18n: import latest common.json from Crowdin
wackerow Feb 22, 2024
fc35ae7
chore: move acronym to start of label
wackerow Feb 22, 2024
10febb3
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 23, 2024
906078d
fix: typos
wackerow Feb 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
"./src/intl/**/*",
"!./public/**/*",
"!./node_modules/@swc/core-linux-x64-musl/**/*",
"!./node_modules/@swc/core-linux-x64-gnu/**/*",
]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@docsearch/react": "^3.5.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@socialgouv/matomo-next": "^1.8.0",
"clipboard": "^2.0.11",
"embla-carousel-react": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/@chakra-ui/foundations/spacing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const spacing = {
7.5: "1.875rem",
10.5: "2.625rem",
19: "4.75rem", // Nav height
}

export default spacing
6 changes: 6 additions & 0 deletions src/@chakra-ui/semanticTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ const semanticTokens = {
"linear-gradient(102.7deg, rgba(185, 185, 241, 0.2) 0%, rgba(84, 132, 234, 0.2) 51.56%, rgba(58, 142, 137, 0.2) 100%)",
},
},
shadows: {
menu: {
accordion:
"0px 2px 2px 0px rgba(0, 0, 0, 0.12) inset, 0px -3px 2px 0px rgba(0, 0, 0, 0.14) inset",
},
},
}

export default semanticTokens
4 changes: 2 additions & 2 deletions src/components/LanguagePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const LanguagePicker = ({
{/* Mobile Close bar */}
<Flex
justifyContent="end"
hideFrom="lg" // TODO: Confirm breakpoint after nav-menu PR merged
hideFrom="md"
position="sticky"
zIndex="sticky"
top="0"
Expand Down Expand Up @@ -139,7 +139,7 @@ const LanguagePicker = ({
}}
/>
<InputRightElement
hideBelow="lg" // TODO: Confirm breakpoint after nav-menu PR merged
hideBelow="md"
cursor="text"
>
<Kbd
Expand Down
8 changes: 4 additions & 4 deletions src/components/Nav/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box, Fade, Flex, Icon, ListItem } from "@chakra-ui/react"

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

import { ISection } from "./types"
import { NavSectionDetail } from "./types"

import { useOnClickOutside } from "@/hooks/useOnClickOutside"

Expand Down Expand Up @@ -41,7 +41,7 @@ const DropdownContext = React.createContext<DropdownContext | null>(null)

export type NavDropdownProps = {
children?: React.ReactNode
section: ISection
section: NavSectionDetail
}

const NavDropdown = ({ children, section }: NavDropdownProps) => {
Expand Down Expand Up @@ -72,7 +72,7 @@ const NavDropdown = ({ children, section }: NavDropdownProps) => {
}
}

const ariaLabel = section.ariaLabel || section.text
const ariaLabel = section.ariaLabel || section.label

return (
<DropdownContext.Provider
Expand Down Expand Up @@ -102,7 +102,7 @@ const NavDropdown = ({ children, section }: NavDropdownProps) => {
},
}}
>
{section.text}
{section.label}
<Icon
as={MdExpandMore}
color="text200"
Expand Down
100 changes: 0 additions & 100 deletions src/components/Nav/Menu.tsx

This file was deleted.

38 changes: 38 additions & 0 deletions src/components/Nav/Menu/ItemContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useRouter } from "next/router"
import { Box, Text } from "@chakra-ui/react"

import { cleanPath } from "@/lib/utils/url"

import type { Level, NavItem } from "../types"

import { useNavMenuColors } from "@/hooks/useNavMenuColors"

type ItemProps = {
item: NavItem
lvl: Level
}

const ItemContent = ({ item, lvl }: ItemProps) => {
const { label, description, icon, ...action } = item
const { asPath } = useRouter()
const menuColors = useNavMenuColors()

const isLink = "href" in action
const isActivePage = isLink && cleanPath(asPath) === action.href

return (
<Box me="auto" textAlign="start" position="relative">
<Text fontWeight="bold" color={menuColors.body}>
{label}
</Text>
<Text
fontSize="sm"
color={isActivePage ? menuColors.body : menuColors.lvl[lvl].subtext}
>
{description}
</Text>
</Box>
)
}

export default ItemContent
15 changes: 15 additions & 0 deletions src/components/Nav/Menu/NextChevron.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useRouter } from "next/router"
import { MdChevronLeft, MdChevronRight } from "react-icons/md"
import { Icon,type IconProps } from "@chakra-ui/react"

import type { Lang } from "@/lib/types"

import { isLangRightToLeft } from "@/lib/utils/translations"

const NextChevron = (props: IconProps) => {
const { locale } = useRouter()
const isRtl = isLangRightToLeft(locale! as Lang)
return <Icon as={isRtl ? MdChevronLeft : MdChevronRight} {...props} />
}

export default NextChevron
Loading
Loading