-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNavigation.tsx
51 lines (49 loc) · 951 Bytes
/
Navigation.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Link from "next/link"
import { useRouter } from "next/router"
const config = [
{
name: 'Home',
path: '/'
},
{
name: '+Create',
path: '/create'
},
{
name: 'My Articles',
path: '/articles-my'
},
{
name: 'All Articles',
path: '/articles-all'
},
{
name: 'My NFTs',
path: '/my-nfts'
},
{
name: 'My Collections',
path: '/my-collections'
},
{
name: 'NFT Market',
path: '/nft-market'
},
]
export const Navigation = () => {
const router = useRouter()
const isActivePath = (path: string) => router.asPath === path
return (
<div className="flex mt-4 grow">
{ config.map((item) => {
return (
<Link key={item.path} href={item.path}>
<a className={`mr-4 text-pink-500 _nav ${ isActivePath(item.path) && 'current'}`} id="_home">
{item.name}
</a>
</Link>
)
})}
</div>
)
}