1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
market/src/components/Header/Menu.tsx
Matthias Kretschmann 1b612e4194
package updates & technical debt cleanup (#1771)
* package updates

* bump Next.js

* update for Next.js v13 new `Link` behavior

* see https://nextjs.org/docs/upgrading#link-component

* test tweaks, simplify getNetworkDisplayName()

* modify codeclimate excludes

* test tweaks and cleanup

* more cleanup

* switch to Node.js v18

* back to Node.js v16

* temporarily run CI against Node.js v16 & v18

* update codeowners

* fixtures fixes for asset price

* switch to Node.js v18

* package updates

* remark updates, typescript and test fixes

* fix

* test run fixes

* yet another lockfileVersion update

* package updates

* test run fixes
2022-12-01 09:09:40 +00:00

60 lines
1.5 KiB
TypeScript

import React, { ReactElement } from 'react'
import Link from 'next/link'
import loadable from '@loadable/component'
import Logo from '@shared/atoms/Logo'
import UserPreferences from './UserPreferences'
import Networks from './UserPreferences/Networks'
import SearchBar from './SearchBar'
import styles from './Menu.module.css'
import { useRouter } from 'next/router'
import { useMarketMetadata } from '@context/MarketMetadata'
const Wallet = loadable(() => import('./Wallet'))
declare type MenuItem = {
name: string
link: string
}
function MenuLink({ item }: { item: MenuItem }) {
const router = useRouter()
const classes =
router?.pathname === item.link
? `${styles.link} ${styles.active}`
: styles.link
return (
<Link key={item.name} href={item.link} className={classes}>
{item.name}
</Link>
)
}
export default function Menu(): ReactElement {
const { siteContent } = useMarketMetadata()
return (
<nav className={styles.menu}>
<Link href="/" className={styles.logo}>
<Logo noWordmark />
<h1 className={styles.title}>{siteContent?.siteTitle}</h1>
</Link>
<ul className={styles.navigation}>
{siteContent?.menu.map((item: MenuItem) => (
<li key={item.name}>
<MenuLink item={item} />
</li>
))}
</ul>
<div className={styles.actions}>
<SearchBar />
<Networks />
<Wallet />
<UserPreferences />
</div>
</nav>
)
}