vega-frontend-monorepo/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx
PeteWilliams b078fc9aad
chore: ui tweaks (#737)
* 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
2022-07-14 17:03:17 +01:00

41 lines
1.1 KiB
TypeScript

import { truncateByChars } from '@vegaprotocol/react-helpers';
import { useVegaWallet } from '@vegaprotocol/wallet';
export interface VegaWalletConnectButtonProps {
setConnectDialog: (isOpen: boolean) => void;
setManageDialog: (isOpen: boolean) => void;
}
export const VegaWalletConnectButton = ({
setConnectDialog,
setManageDialog,
}: VegaWalletConnectButtonProps) => {
const { keypair } = useVegaWallet();
const isConnected = keypair !== null;
const handleClick = () => {
if (isConnected) {
setManageDialog(true);
} else {
setConnectDialog(true);
}
};
return (
<span>
{isConnected && (
<span className="text-ui-small font-mono mr-2 text-white-90">
Vega key:
</span>
)}
<button
data-testid={isConnected ? 'manage-vega-wallet' : 'connect-vega-wallet'}
onClick={handleClick}
className="ml-auto inline-block text-ui-small font-mono hover:underline text-white-90"
>
{isConnected ? truncateByChars(keypair.pub) : 'Connect Vega wallet'}
</button>
</span>
);
};