mars-v2-frontend/components/Navigation.tsx

83 lines
2.0 KiB
TypeScript
Raw Normal View History

import React from "react";
import Link from "next/link";
2022-09-06 17:56:12 +00:00
import { useRouter } from "next/router";
2022-09-07 19:12:19 +00:00
import SearchInput from "components/SearchInput";
2022-09-06 15:16:58 +00:00
const mockedAccounts = [
{
label: "Subaccount 1",
},
{
label: "Subaccount 2",
},
{
label: "Subaccount 3",
},
{
label: "Subaccount 4",
},
];
2022-09-06 17:56:12 +00:00
const NavLink = ({ href, children }: { href: string; children: string }) => {
const router = useRouter();
return (
2022-09-06 17:56:12 +00:00
<Link href={href} passHref>
<a
className={`${
router.pathname === href ? "text-white" : ""
} hover:text-white`}
>
{children}
</a>
</Link>
);
};
const Navigation = () => (
<div>
{/* Main navigation bar */}
<div className="flex justify-between items-center px-6 py-3 border-b border-white/20">
<Link href="/" passHref>
<a>
<img src="/logo.svg" alt="mars" />
</a>
</Link>
<div className="flex px-12 gap-5 text-white/40">
<NavLink href="/trade">Trade</NavLink>
<NavLink href="/yield">Yield</NavLink>
<NavLink href="/borrow">Borrow</NavLink>
<NavLink href="/portfolio">Portfolio</NavLink>
<NavLink href="/council">Council</NavLink>
2022-09-06 15:16:58 +00:00
</div>
2022-09-06 17:56:12 +00:00
<button
className="rounded-3xl bg-green-500 py-2 px-3 font-semibold"
onClick={() => alert("TODO")}
>
Connect Wallet
</button>
</div>
{/* Sub navigation bar */}
<div className="flex justify-between px-6 py-3 text-sm text-white/40">
2022-09-07 19:12:19 +00:00
<div className="flex items-center">
<SearchInput />
2022-09-06 17:56:12 +00:00
{mockedAccounts.map((account, index) => (
2022-09-07 19:12:19 +00:00
<div key={index} className="px-4 hover:text-white cursor-pointer">
2022-09-06 17:56:12 +00:00
{account.label}
</div>
))}
2022-09-07 19:12:19 +00:00
<div className="px-3">More</div>
2022-09-06 17:56:12 +00:00
<div className="px-3">Manage</div>
</div>
2022-09-07 19:12:19 +00:00
<div className="flex gap-4 items-center">
2022-09-06 17:56:12 +00:00
<p>$: 2500</p>
<div>Lvg Gauge</div>
<div>Risk Gauge</div>
2022-09-02 14:30:58 +00:00
</div>
</div>
2022-09-06 17:56:12 +00:00
</div>
);
export default Navigation;