diff --git a/components/Navigation.tsx b/components/Navigation.tsx new file mode 100644 index 0000000..c423c18 --- /dev/null +++ b/components/Navigation.tsx @@ -0,0 +1,52 @@ +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() + console.log(router.asPath); + const isActivePath = (path: string) => router.asPath === path + return ( +
+ { config.map((item) => { + return ( + + + {item.name} + + + ) + })} +
+ ) +} diff --git a/pages/_app.js b/pages/_app.js index 2aafc0a..9a37b31 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,14 +1,13 @@ import "../styles/globals.css" import "../styles/markdown.css" import { FrontendVersion } from "../version.js" -import Link from "next/link" import Head from "next/head" import { useState } from "react" import { ethers } from "ethers" import { Menu, Transition } from "@headlessui/react" -import { Fragment, useEffect, useRef } from "react" +import { Fragment, useEffect } from "react" import { ChevronDownIcon } from "@heroicons/react/solid" -import { useRouter } from "next/router" +import {Navigation} from "../components/Navigation"; import axios from "axios" // On production, you should use something like web3Modal @@ -181,43 +180,7 @@ function Marketplace({ Component, pageProps }) {