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

Release candidate 8.2.0 #12313

Merged
merged 458 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
458 commits
Select commit Hold shift + click to select a range
ad3457c
return a permanent redirect status code on redirects from fake locale…
pettinarip Feb 16, 2024
7765a84
Removes /deprecated-software from translations
FaybianB Feb 16, 2024
8ae7e73
chore: remove empty intl strings
wackerow Feb 16, 2024
d85fe5b
fix: fallback to Intl.DisplayNames
wackerow Feb 16, 2024
ae26197
Update Crowdin translation progress
actions-user Feb 16, 2024
3ec6e7f
Merge pull request #12200 from FaybianB/12193-Deprecate-Deprecated-So…
nhsz Feb 16, 2024
386d5fb
Merge pull request #12205 from ethereum/automated-update-20240216162606
nhsz Feb 16, 2024
074c989
Merge pull request #12204 from ethereum/intl-empty-strings
wackerow Feb 16, 2024
fd4d922
Merge branch 'ethereum:dev' into shyam-header-fix
shyam-patel-kira Feb 16, 2024
c881349
Merge pull request #11772 from shyam-patel-kira/shyam-header-fix
nhsz Feb 16, 2024
f0c41ee
chore: update paths for trailingSlash=true
wackerow Feb 16, 2024
2843961
Fixing typo
xersky Feb 16, 2024
300ce2f
design: adjust menu padding
wackerow Feb 16, 2024
68e257b
chore: rm trailing slashes
wackerow Feb 16, 2024
2165911
chore: add trailing slashes to useNav href's
wackerow Feb 16, 2024
89119b0
Fix markdown code format
xersky Feb 17, 2024
15a1a38
Fix link
omahs Feb 17, 2024
afd3679
Fix link
omahs Feb 17, 2024
cbda953
Fix link
omahs Feb 17, 2024
34e8fdc
Fix link
omahs Feb 17, 2024
67b631a
Fix link
omahs Feb 17, 2024
0714968
fix: remove margin from the Icon component and add it to the BaseLink…
AjayiMike Feb 17, 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
ce717a4
Update Crowdin contributors
actions-user Feb 18, 2024
94f6d65
Merge branch 'nav-menu-radix-ui' of https://github.com/ethereum/ether…
wackerow Feb 18, 2024
d7b66b3
docs: adds more community QA process details
nhsz Feb 18, 2024
d7614c4
Merge pull request #12215 from xersky/patch-5
nhsz Feb 18, 2024
0b65ef8
Merge pull request #12211 from xersky/patch-4
nhsz Feb 18, 2024
2432c3b
added disclaimer to stablecoin page
gabrieltemtsen Feb 16, 2024
124a42e
Merge pull request #12223 from AjayiMike/12213-social-button-sizing
pettinarip Feb 19, 2024
c7a579c
Fix discord links
omahs Feb 19, 2024
f3c2d38
Fix discord link
omahs Feb 19, 2024
daa13ad
chore: apply suggestions from code review
wackerow Feb 19, 2024
0194755
intl: update menu string with acronym first
wackerow Feb 19, 2024
7438ac3
refactor: extract getOgImage util
wackerow Feb 17, 2024
acc20cb
feat: add/update page og images
wackerow Feb 17, 2024
533ef48
fix: metadata string namespaces
wackerow Feb 17, 2024
564217a
Merge pull request #12225 from ethereum/automated-update-20240218001042
corwintines Feb 19, 2024
e92856f
add hreflangs
pettinarip Feb 20, 2024
f1b775c
Merge pull request #12210 from ethereum/trailing-slash-cleanup
pettinarip Feb 20, 2024
2e2de93
Merge branch 'dev' into default-local-prefix
pettinarip Feb 20, 2024
6c006df
intl: update dapps label with acronym first
wackerow Feb 20, 2024
1899364
intl: import common.json bundle
wackerow Feb 20, 2024
ed5278d
chore: remove redundant / unused
wackerow Feb 20, 2024
6cb3230
chore: remove comment
wackerow Feb 20, 2024
007879f
chore: remove link to blog post until available
wackerow Feb 20, 2024
99851e0
chore(deps): bump ip from 2.0.0 to 2.0.1
dependabot[bot] Feb 20, 2024
521d09d
Azerbaijani Feb 20 (Essentials)
corwintines Feb 20, 2024
de73093
Update page-staking.json
zarifpour Feb 20, 2024
0486d7b
Chinese import Feb 20 (Homepage, Essentials, Use cases, Docs - tech s…
corwintines Feb 20, 2024
c49a434
Chinese traditional import Feb 20 (Homepage, Essentials, Exploring, U…
corwintines Feb 20, 2024
bda4b36
French import Feb 20 (Homepage, Community, Foundational docs - proof-…
corwintines Feb 20, 2024
de8ddd2
Hungarian import Feb 20 (Homepage, Use cases, Community, Foundational…
corwintines Feb 20, 2024
867f1c2
Indonesian import Feb 20 (Essentials, Use Ethereum, Use cases,
corwintines Feb 20, 2024
95eb1d7
Merge pull request #12237 from ethereum/dependabot/npm_and_yarn/ip-2.0.1
corwintines Feb 20, 2024
3c46704
Italian import Feb 20 (Homepage, Essentials)
corwintines Feb 20, 2024
2f4ae29
Nigerian Pidgin import Feb 20 (Essentials)
corwintines Feb 20, 2024
4823e38
Polish import Feb 20 (Essentials, Use cases, Learn hub & guide)
corwintines Feb 21, 2024
ae2b462
revert: string regressions / english strings
wackerow Feb 21, 2024
0e8dbbe
Merge pull request #12238 from ethereum/azerbaijaniImport
wackerow Feb 21, 2024
1b56a44
Merge pull request #12240 from ethereum/chineseSimplifiedImport
wackerow Feb 21, 2024
a0dd13b
fix: whitespace/markdown syntax fr import
wackerow Feb 21, 2024
90e26e6
fix: spelling and whitespace bugs
wackerow Feb 21, 2024
56750e0
fix: header level nesting, add custom header id
wackerow Feb 21, 2024
ca332bc
Spanish import Feb 20 (Tutorials II, Tutorials III, Tutorials IV)
corwintines Feb 21, 2024
0ddaee9
Merge pull request #12248 from ethereum/copy-patch
corwintines Feb 21, 2024
321ab9e
Merge pull request #12222 from omahs/patch-5
corwintines Feb 21, 2024
c8fc6c2
fix: md link syntax
wackerow Feb 21, 2024
6a924f5
revert: merge year change
wackerow Feb 21, 2024
281e543
fix: Ethereum spelling
wackerow Feb 21, 2024
f9e3529
fix: whitespace, name capitalization
wackerow Feb 21, 2024
2dfc878
revert: `featured` class; use FeaturedText
wackerow Feb 21, 2024
b094f1b
Merge pull request #12247 from ethereum/polishImport
wackerow Feb 21, 2024
e91b336
Use header as H1 if title missing
minimalsm Feb 21, 2024
0d8bb14
Fix error syntax
minimalsm Feb 21, 2024
5748953
Add H1 to bug bounty page
minimalsm Feb 21, 2024
b5b0200
Add H1 to zero knowledge proofs pages
minimalsm Feb 21, 2024
7940093
Add H1 to content standardization pages
minimalsm Feb 21, 2024
a0f5f6b
Add H1 to adding design resources pages
minimalsm Feb 21, 2024
90d220a
chore: remove Brave wallet data
nhsz Feb 21, 2024
c2b4b3e
chore: remove MyCrypto wallet data
nhsz Feb 21, 2024
4b97780
chore: remove ShapeShift wallet data
nhsz Feb 21, 2024
5fbed75
chore: remove Status wallet data
nhsz Feb 21, 2024
e4c579f
chore: remove Web3Auth wallet data
nhsz Feb 21, 2024
49b54f4
Add H1 to community code of conduct pages
minimalsm Feb 21, 2024
79b127d
chore: remove unused wallets images
nhsz Feb 21, 2024
ede83ca
Add H1 to events pages
minimalsm Feb 21, 2024
9f65cf0
Add H1 to translatathon page
minimalsm Feb 21, 2024
1e58c46
Add H1 to tutorials template
minimalsm Feb 21, 2024
76d6930
Merge pull request #12134 from ethereum/default-local-prefix
pettinarip Feb 21, 2024
240d289
build: rm manifest app previews, rm assets
wackerow Feb 21, 2024
b19d47a
Merge branch 'dev' into hreflang
pettinarip Feb 21, 2024
a64eb3f
Update index.md
minimalsm Feb 21, 2024
b991f94
Merge branch 'dev' of github.com:ethereum/ethereum-org-website into dev
nhsz Feb 21, 2024
b2ddd2c
Merge pull request #12261 from ethereum/minimalsm-patch-7
wackerow Feb 21, 2024
caf472b
Merge pull request #12241 from ethereum/frenchImport
wackerow Feb 21, 2024
99b5e1d
Merge branch 'dev' into hungarianImport
wackerow Feb 21, 2024
e694d3d
Merge pull request #12242 from ethereum/hungarianImport
wackerow Feb 21, 2024
f23b379
Merge pull request #12243 from ethereum/indonesianImport
wackerow Feb 21, 2024
78d2287
Merge pull request #12244 from ethereum/italianImportFeb20
wackerow Feb 21, 2024
e08a4f9
Merge pull request #12245 from ethereum/nigerianPidginImport
wackerow Feb 21, 2024
91c8eee
Merge branch 'dev' into spanishImport
wackerow Feb 21, 2024
79ba200
Merge pull request #12249 from ethereum/spanishImport
wackerow Feb 21, 2024
f26ce3f
Merge branch 'dev' into koreanImport
wackerow Feb 21, 2024
2595526
Merge branch 'dev' of github.com:ethereum/ethereum-org-website into dev
nhsz Feb 21, 2024
0cfdd7a
Merge pull request #12260 from ethereum/manifest
corwintines Feb 21, 2024
05a18d7
Merge pull request #11982 from ethereum/koreanImport
wackerow Feb 21, 2024
d9fb2bf
Merge pull request #12254 from ethereum/fixHubHeroH1
corwintines Feb 21, 2024
ce03fe3
Merge pull request #12256 from ethereum/fixBugBountyH1
corwintines Feb 21, 2024
c3cecae
Merge pull request #12258 from ethereum/fixMissingH1sInText
corwintines Feb 21, 2024
62fec01
Merge pull request #12257 from ethereum/update-wallet-data
corwintines Feb 21, 2024
19f663c
Merge pull request #12228 from ethereum/docs-qa-process
corwintines Feb 21, 2024
05d1c3d
Cleanup
corwintines Feb 21, 2024
4bdedb9
cleanup
corwintines Feb 21, 2024
9b062bc
remove extra space
corwintines Feb 21, 2024
a7bbfda
Merge pull request #12229 from gabrieltemtsen/gabe-dev
corwintines Feb 21, 2024
2db4ea3
Merge pull request #12231 from omahs/patch-6
corwintines Feb 21, 2024
2bdc886
i18n: import latest common.json from Crowdin
wackerow Feb 22, 2024
0d82cbc
update swapping guide - remove kernel link
konopkja Feb 22, 2024
c16ca5b
chore: remove Portis wallet
nhsz Feb 22, 2024
0189cf0
chore: remove Sequence wallet
nhsz Feb 22, 2024
78c3b9f
chore: remove Aktionariat wallet
nhsz Feb 22, 2024
bebcdc4
chore: remove Numio wallet
nhsz Feb 22, 2024
f942941
chore: remove Opera wallet
nhsz Feb 22, 2024
2348740
Update src/intl/en/page-staking.json
corwintines Feb 22, 2024
82bc02b
docs: update README.md [skip ci]
allcontributors[bot] Feb 22, 2024
7282531
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Feb 22, 2024
85abc16
Merge pull request #12270 from ethereum/all-contributors/add-zarifpour
corwintines Feb 22, 2024
f7c6017
Merge pull request #12239 from zarifpour/dev
corwintines Feb 22, 2024
3ff7c30
Merge pull request #12268 from ethereum/konopkja-patch-2
corwintines Feb 22, 2024
b976889
hide contributor profile link if the url doesn't exist
pettinarip Feb 22, 2024
25ab899
chore: update roadmap home image
wackerow Feb 22, 2024
08d3bb6
Add glossary definition for proto-danksharding
corwintines Feb 22, 2024
e67d2e5
Merge pull request #12234 from ethereum/og-images
nhsz Feb 22, 2024
9e938d1
Merge branch 'dev' of github.com:ethereum/ethereum-org-website into dev
nhsz 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
4413b71
Fix typo
rex4539 Feb 22, 2024
61cc20b
i18n: update page-languages.json from Crowdin
wackerow Feb 22, 2024
8c6ff4c
Merge branch 'dev' into hreflang
nhsz Feb 22, 2024
6ae1d75
Merge pull request #12259 from ethereum/hreflang
nhsz Feb 22, 2024
3d8dcff
Merge pull request #12271 from ethereum/remove-wallets
nhsz Feb 22, 2024
fc35ae7
chore: move acronym to start of label
wackerow Feb 22, 2024
d77b3a2
feat: add matomo event to lang picker input
wackerow Feb 22, 2024
566774c
chore: run autofix to sort imports
wackerow Feb 23, 2024
ca4f2bd
chore: run autofix to sort imports
wackerow Feb 23, 2024
a24037d
Merge pull request #12277 from ethereum/build-fix
corwintines Feb 23, 2024
10febb3
Merge branch 'dev' into nav-menu-radix-ui
wackerow Feb 23, 2024
906078d
fix: typos
wackerow Feb 23, 2024
61e0f95
Update Sassal link
minimalsm Feb 23, 2024
da01fa9
Fix vyper discord link
minimalsm Feb 23, 2024
54a370d
fix: cleanup dead link
enjoyooor Feb 23, 2024
10902cc
Fix broken eip 1803 link
minimalsm Feb 23, 2024
9574c63
Fix broken contributor link
minimalsm Feb 23, 2024
de4f015
Update 404 mining link
minimalsm Feb 23, 2024
b51161e
Merge pull request #12272 from ethereum/fix-bad-links
minimalsm Feb 23, 2024
f323dce
Fix manticore link
minimalsm Feb 23, 2024
88dd82e
Fix broken anatomy link
minimalsm Feb 23, 2024
fcf74ab
Fix broken contributing link
minimalsm Feb 23, 2024
b768ee3
Fix broken blog link
minimalsm Feb 23, 2024
4d9bbc6
Fix broken danksharding link
minimalsm Feb 23, 2024
1109dcb
Fix broken eth glossary links
minimalsm Feb 23, 2024
ffb7f3d
Fix broken pbs link
minimalsm Feb 23, 2024
54330f3
Fix contributor profile link url
minimalsm Feb 23, 2024
582a1e7
Fix broken merge links
minimalsm Feb 23, 2024
d059385
Fix broken waffle tutorial link
minimalsm Feb 23, 2024
92375b7
Fix broken tutorial link
minimalsm Feb 23, 2024
a0de1ff
Fix broken governance link
minimalsm Feb 23, 2024
dc07c0a
Fix random figma link
minimalsm Feb 23, 2024
9e30b36
Fix broken staking links
minimalsm Feb 23, 2024
ad61711
Fix broken staking links
minimalsm Feb 23, 2024
99e3206
Fix broken staking links
minimalsm Feb 23, 2024
7d4104b
Fix misc broken links
minimalsm Feb 23, 2024
97489c4
Fix broken links
minimalsm Feb 23, 2024
ff9f18e
More broken links!
minimalsm Feb 23, 2024
698bb11
Merge pull request #12280 from bholuhacks/link
nhsz Feb 23, 2024
0d63d47
Broken links
minimalsm Feb 23, 2024
20dd314
Broken links
minimalsm Feb 23, 2024
d287d6b
Update Crowdin translation progress
actions-user Feb 23, 2024
8473987
Merge pull request #12274 from rex4539/typos
minimalsm Feb 23, 2024
e7bc5de
Merge pull request #12125 from ethereum/nav-menu-radix-ui
corwintines Feb 23, 2024
b5f0f64
Merge pull request #12283 from ethereum/automated-update-20240223162538
corwintines Feb 23, 2024
d6d942f
Merge pull request #12281 from ethereum/fixDoubleSlashedUrls
wackerow Feb 23, 2024
0f9ae18
Update Crowdin contributors
actions-user Feb 25, 2024
8e95063
Merge pull request #12276 from ethereum/matomo-lang-picker
nhsz Feb 25, 2024
29cd022
Update execution-bounty-hunters.json
fredriksvantes Feb 25, 2024
a948dc4
Update execution-bounty-hunters.json
fredriksvantes Feb 26, 2024
fe57d91
Remove View in English button
minimalsm Feb 26, 2024
02e437e
Delete duplicates and restructure english content
minimalsm Feb 26, 2024
3c17ce5
Remove unused tutorials and fix broken links/urls
minimalsm Feb 26, 2024
17ad0e4
Disable SVG URLs in AssetDownload
minimalsm Feb 26, 2024
24a8846
Update security.txt
minimalsm Feb 26, 2024
113f50f
Update src/intl/en/glossary.json
pettinarip Feb 26, 2024
f389159
Merge pull request #12298 from ethereum/updateSecurity
corwintines Feb 26, 2024
1ab931e
Merge pull request #12295 from ethereum/restructureMiningDocs
corwintines Feb 26, 2024
f3643aa
Merge pull request #12293 from ethereum/hideViewInEnglish
corwintines Feb 26, 2024
f9ee3b7
Merge pull request #12296 from ethereum/removeUnusedTutorials
corwintines Feb 26, 2024
8c627cf
Merge pull request #12297 from ethereum/hideSVGUrl
corwintines Feb 26, 2024
466368f
Update public/content/translations/id/developers/docs/apis/javascript…
corwintines Feb 26, 2024
731df9c
Update public/content/translations/id/developers/tutorials/waffle-dyn…
corwintines Feb 26, 2024
36d2ee3
Update public/content/translations/it/developers/tutorials/waffle-dyn…
corwintines Feb 26, 2024
fd4a1f4
Update public/content/translations/it/developers/tutorials/waffle-tes…
corwintines Feb 26, 2024
1dc498d
Update public/content/translations/pl/developers/tutorials/waffle-dyn…
corwintines Feb 26, 2024
02e2125
Update public/content/translations/pt-br/developers/tutorials/waffle-…
corwintines Feb 26, 2024
ed46787
Update public/content/translations/ro/developers/docs/apis/javascript…
corwintines Feb 26, 2024
8c4942b
Update public/content/translations/tr/developers/tutorials/waffle-dyn…
corwintines Feb 26, 2024
99fbec4
Update public/content/translations/tr/developers/tutorials/waffle-tes…
corwintines Feb 26, 2024
7408fee
Update public/content/translations/zh/developers/tutorials/waffle-dyn…
corwintines Feb 26, 2024
8732618
Update public/content/translations/zh/developers/tutorials/waffle-tes…
corwintines Feb 26, 2024
9af2aa6
Update public/content/translations/id/enterprise/index.md
corwintines Feb 26, 2024
aa29274
Merge branch 'dev' into fixBrokenLinksSEO
corwintines Feb 26, 2024
8ee3ccb
Merge pull request #12282 from ethereum/fixBrokenLinksSEO
corwintines Feb 26, 2024
3d20b7f
Merge pull request #12290 from ethereum/fredriksvantes-patch-1
corwintines Feb 26, 2024
6f03615
Merge pull request #12284 from ethereum/automated-update-20240225001102
corwintines Feb 26, 2024
ed985d3
Merge pull request #12212 from ethereum/nav-menu-trailing-slash-fix
corwintines Feb 26, 2024
d573b50
Merge branch 'dev' into pr/aseoconnor/11870
corwintines Feb 27, 2024
0de3db3
ordering
corwintines Feb 27, 2024
bd4689a
Merge pull request #11870 from aseoconnor/patch-4
corwintines Feb 27, 2024
7262601
Merge pull request #12016 from Shiva-Sai-ssb/include
pettinarip Feb 27, 2024
f40ee60
Merge branch 'dev' of github.com:ethereum/ethereum-org-website into dev
nhsz Feb 27, 2024
8efa556
chore: removes AirGap wallet
nhsz Feb 27, 2024
62a642b
chore: removes Coin wallet
nhsz Feb 27, 2024
3641535
chore: removes ZenGo wallet
nhsz Feb 27, 2024
5ff4b7d
chore: removes Guarda wallet
nhsz Feb 27, 2024
1893142
chore: removes Bitcoin.com wallet
nhsz Feb 27, 2024
701d7ed
chore: removes unused wallets assets
nhsz Feb 27, 2024
b6f9348
chore: update with link to blog announcement
wackerow Feb 27, 2024
7b9192a
fix: remove extra forward slashes
nhsz Feb 27, 2024
6f85dd7
fix Ethereum&nbsp spelling in french learn page
celstnblacc Feb 27, 2024
a109f3b
Merge pull request #12308 from ethereum/remove-wallets-without-eip155…
corwintines Feb 27, 2024
9fccfa2
Merge pull request #12309 from ethereum/fix-extra-forward-slashes
minimalsm Feb 27, 2024
97b81a5
Merge pull request #12310 from celstnblacc/translate-fr-spelling
nhsz Feb 27, 2024
aa6321c
Merge branch 'staging' into dev
corwintines Feb 27, 2024
dd04331
formatting
corwintines Feb 27, 2024
df07ae7
Update public/content/roadmap/danksharding/index.md
corwintines Feb 27, 2024
694e413
Merge pull request #12189 from ethereum/dencun
corwintines Feb 27, 2024
4c6770f
i18n: common.json import
wackerow Feb 27, 2024
855926c
Merge pull request #12273 from ethereum/protoDankshardingDefinition
corwintines Feb 27, 2024
cf3781c
Merge pull request #12316 from ethereum/nav-menu-translations
corwintines Feb 27, 2024
e1ed202
Merge pull request #12275 from ethereum/page-languages
corwintines Feb 27, 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
Prev Previous commit
Next Next commit
refactor: LvlContent -> SubMenu, extract hook
  • Loading branch information
wackerow committed Feb 17, 2024
commit 7f1cc7bb2d45f4052f3eeec3c7edd6c10d83de28
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AnimatePresence, motion, type MotionProps } from "framer-motion"
import { AnimatePresence, motion } from "framer-motion"
import NextLink from "next/link"
import { useRouter } from "next/router"
import {
Box,
Button,
Expand All @@ -21,14 +20,13 @@ import type { Level, NavItem, NavSectionKey } from "../types"

import ItemContent from "./ItemContent"
import NextChevron from "./NextChevron"

import { useNavMenuColors } from "@/hooks/useNavMenuColors"
import { useRtlFlip } from "@/hooks/useRtlFlip"
import { useSubMenu } from "./useSubMenu"

type LvlContentProps = {
lvl: Level
items: NavItem[]
activeSection: NavSectionKey | null
onClose: () => void
}

/**
Expand All @@ -37,26 +35,36 @@ type LvlContentProps = {
* @param lvl - The level of the menu
* @param items - The items to be displayed in the menu
* @param activeSection - English label of the active section for event tracking
* @param onClose - Function to close the menu
* @returns The JSX element representing the menu content.
*/
const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
const { asPath, locale } = useRouter()
const menuColors = useNavMenuColors()
const { isRtl } = useRtlFlip()
const SubMenu = ({
lvl,
items,
activeSection,
onClose,
}: LvlContentProps) => {
const {
activeSub,
asPath,
locale,
menuColors,
menuVariants,
PADDING,
setActiveSub,
handleSubMenuChange,
} = useSubMenu()

if (lvl > 3) return null

const pad = 4 // Chakra-UI space token

const templateColumns = `repeat(${4 - lvl}, 1fr)`

const menuVariants: MotionProps["variants"] = {
closed: { opacity: 0, scaleX: 0.8, originX: isRtl ? 1 : 0 },
open: { opacity: 1, scaleX: 1 },
}

return (
<NavigationMenu.Sub orientation="vertical" asChild>
<NavigationMenu.Sub
orientation="vertical"
asChild
onValueChange={handleSubMenuChange}
>
<AnimatePresence>
<Grid
as={motion.div}
Expand All @@ -69,7 +77,7 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
gridTemplateColumns={templateColumns}
>
<NavigationMenu.List asChild>
<UnorderedList listStyleType="none" p={pad / 2} m="0">
<UnorderedList listStyleType="none" p={PADDING / 2} m="0">
{items.map((item) => {
const { label, description, icon, ...action } = item
const subItems = action.items || []
Expand All @@ -88,11 +96,11 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
rightIcon: isLink ? undefined : <NextChevron />,
position: "relative",
w: "full",
me: -pad,
me: -PADDING,
sx: {
"span:first-of-type": { m: 0, me: 4 }, // Spacing for icon
},
py: pad,
py: PADDING,
bg: isActivePage
? menuColors.lvl[lvl].activeBackground
: "none",
Expand All @@ -101,17 +109,17 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
variant: "ghost",
}
return (
<NavigationMenu.Item key={label} asChild>
<NavigationMenu.Item key={label} asChild value={label}>
<ListItem
mb={pad / 2}
mb={PADDING / 2}
_last={{ mb: 0 }}
sx={{
'&:has(button[data-state="open"])': {
roundedStart: "md",
roundedEnd: "none",
bg: menuColors.lvl[lvl].activeBackground,
me: -pad,
pe: pad,
me: -PADDING,
pe: PADDING,
},
}}
>
Expand All @@ -120,13 +128,14 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
<NavigationMenu.Link asChild>
<Button
as={Link}
onClick={() =>
onClick={() => {
onClose()
trackCustomEvent({
eventCategory: "Desktop navigation menu",
eventAction: `Menu - ${activeSection} - ${locale}`,
eventName: action.href!,
})
}
}}
{...buttonProps}
>
<ItemContent item={item} lvl={lvl} />
Expand All @@ -145,10 +154,11 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
bg={menuColors.lvl[lvl + 1].background}
h="full"
>
<LvlContent
<SubMenu
lvl={(lvl + 1) as Level}
items={subItems}
activeSection={activeSection}
onClose={onClose}
/>
</Box>
</NavigationMenu.Content>
Expand All @@ -167,4 +177,4 @@ const LvlContent = ({ lvl, items, activeSection }: LvlContentProps) => {
)
}

export default LvlContent
export default SubMenu
4 changes: 2 additions & 2 deletions src/components/Nav/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SECTION_LABELS } from "@/lib/constants"

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

import LvlContent from "./LvlContent"
import SubMenu from "./LvlContent"
import { useNavMenu } from "./useNavMenu"

type NavMenuProps = BoxProps & {
Expand Down Expand Up @@ -93,7 +93,7 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
borderColor={menuColors.stroke}
bg={menuColors.lvl[1].background}
>
<LvlContent
<SubMenu
lvl={1}
items={items}
activeSection={activeSection}
Expand Down
35 changes: 35 additions & 0 deletions src/components/Nav/Menu/useSubMenu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useState } from "react"
import type { MotionProps } from "framer-motion"
import { useRouter } from "next/router"

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

const PADDING = 4 // Chakra-UI space token

export const useSubMenu = () => {
const { asPath, locale } = useRouter()
const menuColors = useNavMenuColors()
const { isRtl } = useRtlFlip()
const [activeSub, setActiveSub] = useState<string | null>(null)

const menuVariants: MotionProps["variants"] = {
closed: { opacity: 0, scaleX: 0.8, originX: isRtl ? 1 : 0 },
open: { opacity: 1, scaleX: 1, originX: isRtl ? 1 : 0 },
}

const handleSubMenuChange = (value: string) => {
setActiveSub(value)
}

return {
activeSub,
asPath,
locale,
menuColors,
menuVariants,
PADDING,
setActiveSub,
handleSubMenuChange,
}
}