b078fc9aad
* chore: change tab panel background and spacing * chore: prevent tabs shiting on click, bg tweak * chore: adjust chrome layout/spacing * chore: fix horizontal alignment when accordion chevron rotates * chore: adjusting bold levels and making market name pink on light theme * chore: changing white theme header to black background * chore: re-ordering bottom tabs * chore: tweaking font sizes * chore: adjusting dropdown button hover colour * chore: colour tweaks for accessibility, plus orderbook column widths * Remove redundant style Removed 'bg-white' left by error. * Setting header text to white * chore: alterative fix to prevent tabs moving * chore: fixing header font colours * chore: adding padding to orderbook * chore: preventing modal close icon from moving on focus * chore: remove inner shadow from selectbox * chore: adding padding to orderbook * chore: preventing @ sign from moving when changing order type * chore: fix background colour on smaller responsive view * chore: fix truncated market header on smaller responsive view * chore: reorder tabs in smaller responsive view to match standard view * fix: fix broken test
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { useRouter } from 'next/router';
|
|
import { Vega } from '../icons/vega';
|
|
import Link from 'next/link';
|
|
import { t } from '@vegaprotocol/react-helpers';
|
|
import classNames from 'classnames';
|
|
|
|
export const Navbar = () => {
|
|
return (
|
|
<nav className="flex items-center">
|
|
<Link href="/" passHref={true}>
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
<a className="px-[26px]">
|
|
<Vega className="fill-white" />
|
|
</a>
|
|
</Link>
|
|
{[
|
|
{ name: t('Trading'), path: '/markets' },
|
|
{ name: t('Portfolio'), path: '/portfolio' },
|
|
].map((route) => (
|
|
<NavLink key={route.path} {...route} />
|
|
))}
|
|
</nav>
|
|
);
|
|
};
|
|
|
|
interface NavLinkProps {
|
|
name: string;
|
|
path: string;
|
|
exact?: boolean;
|
|
testId?: string;
|
|
}
|
|
|
|
const NavLink = ({ name, path, exact, testId = name }: NavLinkProps) => {
|
|
const router = useRouter();
|
|
const isActive =
|
|
router.asPath === path || (!exact && router.asPath.startsWith(path));
|
|
const linkClasses = classNames(
|
|
'px-16 py-6 border-0 self-end',
|
|
'uppercase xs:text-ui sm:text-body-large md:text-h5 lg:text-h4',
|
|
{
|
|
'bg-vega-pink dark:bg-vega-yellow text-white dark:text-black': isActive,
|
|
'text-white': !isActive,
|
|
}
|
|
);
|
|
return (
|
|
<Link data-testid={testId} href={path} passHref={true}>
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
<a className={linkClasses}>{name}</a>
|
|
</Link>
|
|
);
|
|
};
|