feat: align governance right (#2358)
This commit is contained in:
parent
cbbec5c688
commit
97a264d0b8
@ -105,7 +105,6 @@ interface AppNavLinkProps {
|
|||||||
path: string;
|
path: string;
|
||||||
navbarTheme: NavbarTheme;
|
navbarTheme: NavbarTheme;
|
||||||
testId?: string;
|
testId?: string;
|
||||||
alignRight?: boolean;
|
|
||||||
target?: HTMLAttributeAnchorTarget;
|
target?: HTMLAttributeAnchorTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +112,6 @@ const AppNavLink = ({
|
|||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
navbarTheme,
|
navbarTheme,
|
||||||
alignRight,
|
|
||||||
target,
|
target,
|
||||||
testId = name,
|
testId = name,
|
||||||
}: AppNavLinkProps) => {
|
}: AppNavLinkProps) => {
|
||||||
@ -125,7 +123,7 @@ const AppNavLink = ({
|
|||||||
<NavLink
|
<NavLink
|
||||||
data-testid={testId}
|
data-testid={testId}
|
||||||
to={{ pathname: path }}
|
to={{ pathname: path }}
|
||||||
className={getNavLinkClassNames(navbarTheme, alignRight)}
|
className={getNavLinkClassNames(navbarTheme)}
|
||||||
target={target}
|
target={target}
|
||||||
end={true}
|
end={true}
|
||||||
>
|
>
|
||||||
|
@ -4,7 +4,7 @@ import { NetworkSwitcher, useEnvironment } from '@vegaprotocol/environment';
|
|||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { useGlobalStore } from '../../stores/global';
|
import { useGlobalStore } from '../../stores/global';
|
||||||
import { VegaWalletConnectButton } from '../vega-wallet-connect-button';
|
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 { Vega } from '../icons/vega';
|
||||||
import type { HTMLAttributeAnchorTarget } from 'react';
|
import type { HTMLAttributeAnchorTarget } from 'react';
|
||||||
import { Routes } from '../../pages/client-router';
|
import { Routes } from '../../pages/client-router';
|
||||||
@ -52,15 +52,18 @@ export const Navbar = ({
|
|||||||
path={Routes.PORTFOLIO}
|
path={Routes.PORTFOLIO}
|
||||||
navbarTheme={navbarTheme}
|
navbarTheme={navbarTheme}
|
||||||
/>
|
/>
|
||||||
<div className="flex items-center gap-2 ml-auto">
|
|
||||||
<a
|
<a
|
||||||
href={`${VEGA_TOKEN_URL}/governance`}
|
href={`${VEGA_TOKEN_URL}/governance`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className={getActiveNavLinkClassNames(false, navbarTheme, true)}
|
className={getActiveNavLinkClassNames(false, navbarTheme)}
|
||||||
>
|
>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
{t('Governance')}
|
{t('Governance')}
|
||||||
|
<NewTab />
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
<div className="flex items-center gap-2 ml-auto">
|
||||||
<VegaWalletConnectButton />
|
<VegaWalletConnectButton />
|
||||||
<ThemeSwitcher theme={theme} onToggle={toggleTheme} />
|
<ThemeSwitcher theme={theme} onToggle={toggleTheme} />
|
||||||
</div>
|
</div>
|
||||||
@ -73,7 +76,6 @@ interface AppNavLinkProps {
|
|||||||
path: string;
|
path: string;
|
||||||
navbarTheme: NavbarTheme;
|
navbarTheme: NavbarTheme;
|
||||||
testId?: string;
|
testId?: string;
|
||||||
alignRight?: boolean;
|
|
||||||
target?: HTMLAttributeAnchorTarget;
|
target?: HTMLAttributeAnchorTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +83,6 @@ const AppNavLink = ({
|
|||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
navbarTheme,
|
navbarTheme,
|
||||||
alignRight,
|
|
||||||
target,
|
target,
|
||||||
testId = name,
|
testId = name,
|
||||||
}: AppNavLinkProps) => {
|
}: AppNavLinkProps) => {
|
||||||
@ -93,7 +94,7 @@ const AppNavLink = ({
|
|||||||
<NavLink
|
<NavLink
|
||||||
data-testid={testId}
|
data-testid={testId}
|
||||||
to={{ pathname: path }}
|
to={{ pathname: path }}
|
||||||
className={getNavLinkClassNames(navbarTheme, alignRight)}
|
className={getNavLinkClassNames(navbarTheme)}
|
||||||
target={target}
|
target={target}
|
||||||
>
|
>
|
||||||
{({ isActive }) => {
|
{({ isActive }) => {
|
||||||
|
@ -2,25 +2,22 @@ import classNames from 'classnames';
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
export function getNavLinkClassNames(
|
export function getNavLinkClassNames(
|
||||||
navbarTheme: string,
|
navbarTheme: string
|
||||||
alignRight = false
|
|
||||||
): (props: { isActive?: boolean }) => string | undefined {
|
): (props: { isActive?: boolean }) => string | undefined {
|
||||||
return ({ isActive = false }) => {
|
return ({ isActive = false }) => {
|
||||||
return getActiveNavLinkClassNames(isActive, navbarTheme, alignRight);
|
return getActiveNavLinkClassNames(isActive, navbarTheme);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getActiveNavLinkClassNames = (
|
export const getActiveNavLinkClassNames = (
|
||||||
isActive: boolean,
|
isActive: boolean,
|
||||||
navbarTheme: string,
|
navbarTheme: string
|
||||||
alignRight = false
|
|
||||||
): string | undefined => {
|
): string | undefined => {
|
||||||
return classNames('mx-2 py-3 self-end relative', {
|
return classNames('mx-2 py-3 self-end relative', {
|
||||||
'cursor-default': isActive,
|
'cursor-default': isActive,
|
||||||
'text-black dark:text-white': isActive && navbarTheme !== 'yellow',
|
'text-black dark:text-white': isActive && navbarTheme !== 'yellow',
|
||||||
'text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-neutral-300':
|
'text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-neutral-300':
|
||||||
!isActive && navbarTheme !== 'yellow',
|
!isActive && navbarTheme !== 'yellow',
|
||||||
'ml-auto': alignRight,
|
|
||||||
'text-black': isActive && navbarTheme === 'yellow',
|
'text-black': isActive && navbarTheme === 'yellow',
|
||||||
'text-black/60 hover:text-black': !isActive && navbarTheme === 'yellow',
|
'text-black/60 hover:text-black': !isActive && navbarTheme === 'yellow',
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
export * from './cross';
|
export * from './cross';
|
||||||
export * from './diamond';
|
export * from './diamond';
|
||||||
|
export * from './new-tab';
|
||||||
export * from './tick';
|
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