feat: align governance right (#2358)
This commit is contained in:
parent
cbbec5c688
commit
97a264d0b8
@ -105,7 +105,6 @@ interface AppNavLinkProps {
|
||||
path: string;
|
||||
navbarTheme: NavbarTheme;
|
||||
testId?: string;
|
||||
alignRight?: boolean;
|
||||
target?: HTMLAttributeAnchorTarget;
|
||||
}
|
||||
|
||||
@ -113,7 +112,6 @@ const AppNavLink = ({
|
||||
name,
|
||||
path,
|
||||
navbarTheme,
|
||||
alignRight,
|
||||
target,
|
||||
testId = name,
|
||||
}: AppNavLinkProps) => {
|
||||
@ -125,7 +123,7 @@ const AppNavLink = ({
|
||||
<NavLink
|
||||
data-testid={testId}
|
||||
to={{ pathname: path }}
|
||||
className={getNavLinkClassNames(navbarTheme, alignRight)}
|
||||
className={getNavLinkClassNames(navbarTheme)}
|
||||
target={target}
|
||||
end={true}
|
||||
>
|
||||
|
@ -4,7 +4,7 @@ import { NetworkSwitcher, useEnvironment } from '@vegaprotocol/environment';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { useGlobalStore } from '../../stores/global';
|
||||
import { VegaWalletConnectButton } from '../vega-wallet-connect-button';
|
||||
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
|
||||
import { NewTab, ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
|
||||
import { Vega } from '../icons/vega';
|
||||
import type { HTMLAttributeAnchorTarget } from 'react';
|
||||
import { Routes } from '../../pages/client-router';
|
||||
@ -52,15 +52,18 @@ export const Navbar = ({
|
||||
path={Routes.PORTFOLIO}
|
||||
navbarTheme={navbarTheme}
|
||||
/>
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<a
|
||||
href={`${VEGA_TOKEN_URL}/governance`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={getActiveNavLinkClassNames(false, navbarTheme, true)}
|
||||
>
|
||||
<a
|
||||
href={`${VEGA_TOKEN_URL}/governance`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={getActiveNavLinkClassNames(false, navbarTheme)}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
{t('Governance')}
|
||||
</a>
|
||||
<NewTab />
|
||||
</span>
|
||||
</a>
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<VegaWalletConnectButton />
|
||||
<ThemeSwitcher theme={theme} onToggle={toggleTheme} />
|
||||
</div>
|
||||
@ -73,7 +76,6 @@ interface AppNavLinkProps {
|
||||
path: string;
|
||||
navbarTheme: NavbarTheme;
|
||||
testId?: string;
|
||||
alignRight?: boolean;
|
||||
target?: HTMLAttributeAnchorTarget;
|
||||
}
|
||||
|
||||
@ -81,7 +83,6 @@ const AppNavLink = ({
|
||||
name,
|
||||
path,
|
||||
navbarTheme,
|
||||
alignRight,
|
||||
target,
|
||||
testId = name,
|
||||
}: AppNavLinkProps) => {
|
||||
@ -93,7 +94,7 @@ const AppNavLink = ({
|
||||
<NavLink
|
||||
data-testid={testId}
|
||||
to={{ pathname: path }}
|
||||
className={getNavLinkClassNames(navbarTheme, alignRight)}
|
||||
className={getNavLinkClassNames(navbarTheme)}
|
||||
target={target}
|
||||
>
|
||||
{({ isActive }) => {
|
||||
|
@ -2,25 +2,22 @@ import classNames from 'classnames';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export function getNavLinkClassNames(
|
||||
navbarTheme: string,
|
||||
alignRight = false
|
||||
navbarTheme: string
|
||||
): (props: { isActive?: boolean }) => string | undefined {
|
||||
return ({ isActive = false }) => {
|
||||
return getActiveNavLinkClassNames(isActive, navbarTheme, alignRight);
|
||||
return getActiveNavLinkClassNames(isActive, navbarTheme);
|
||||
};
|
||||
}
|
||||
|
||||
export const getActiveNavLinkClassNames = (
|
||||
isActive: boolean,
|
||||
navbarTheme: string,
|
||||
alignRight = false
|
||||
navbarTheme: string
|
||||
): string | undefined => {
|
||||
return classNames('mx-2 py-3 self-end relative', {
|
||||
'cursor-default': isActive,
|
||||
'text-black dark:text-white': isActive && navbarTheme !== 'yellow',
|
||||
'text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-neutral-300':
|
||||
!isActive && navbarTheme !== 'yellow',
|
||||
'ml-auto': alignRight,
|
||||
'text-black': isActive && navbarTheme === 'yellow',
|
||||
'text-black/60 hover:text-black': !isActive && navbarTheme === 'yellow',
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './cross';
|
||||
export * from './diamond';
|
||||
export * from './new-tab';
|
||||
export * from './tick';
|
||||
|
7
libs/ui-toolkit/src/components/vega-icons/new-tab.tsx
Normal file
7
libs/ui-toolkit/src/components/vega-icons/new-tab.tsx
Normal file
@ -0,0 +1,7 @@
|
||||
export const NewTab = () => {
|
||||
return (
|
||||
<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor">
|
||||
<path d="M7.30117 1.32961L1.05914 1.4101L1.04237 0.11021L8.92199 0.00860043L9.58891 0L9.58031 0.666927L9.47871 8.54654L8.17881 8.52978L8.26032 2.20894L0.919239 9.55002L0 8.63078L7.30117 1.32961Z" />
|
||||
</svg>
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user