vega-frontend-monorepo/apps/trading/components/navbar/navbar.tsx
Matthew Russell ed8db76af7
Task/AgGrid and responsive nav font size (#130)
* add custom properties to style ag grid tables

* use theme styles, make nav text sizes responsive

* move row and header heights to parent

* use max-w-full
2022-03-24 11:08:57 -07:00

48 lines
1.2 KiB
TypeScript

import { useRouter } from 'next/router';
import { Vega } from '../icons/vega';
import Link from 'next/link';
import { AnchorButton } from '@vegaprotocol/ui-toolkit';
export const Navbar = () => {
return (
<nav className="flex items-center">
<Link href="/" passHref={true}>
<a className="px-[26px]">
<Vega className="fill-black dark:fill-white" />
</a>
</Link>
{[
{ name: 'Trading', path: '/markets' },
{ name: 'Portfolio', path: '/portfolio' },
].map((route) => (
<NavLink key={route.path} {...route} />
))}
</nav>
);
};
interface NavLinkProps {
name: string;
path: string;
exact?: boolean;
}
const NavLink = ({ name, path, exact }: NavLinkProps) => {
const router = useRouter();
const isActive =
router.asPath === path || (!exact && router.asPath.startsWith(path));
return (
<AnchorButton
variant={isActive ? 'accent' : 'inline'}
className="px-16 py-6 h-[38px] uppercase border-0 self-end xs:text-ui sm:text-body-large md:text-h5 lg:text-h4"
href={path}
onClick={(e) => {
e.preventDefault();
router.push(path);
}}
>
{name}
</AnchorButton>
);
};