vega-frontend-monorepo/apps/trading/components/vega-wallet-connect-button/index.tsx
Matthew Russell 4899d1bce8
Task/Mark translations (#174)
* add dummy i18n translate function to market text that will need translation in future

* add i18n function to aria-labels
2022-03-30 18:08:25 -07:00

31 lines
718 B
TypeScript

import { t } from '@vegaprotocol/react-helpers';
import { useVegaWallet } from '@vegaprotocol/wallet';
interface VegaWalletButtonProps {
setConnectDialog: (isOpen: boolean) => void;
}
export const VegaWalletButton = ({
setConnectDialog,
}: VegaWalletButtonProps) => {
const { disconnect, keypairs } = useVegaWallet();
const isConnected = keypairs !== null;
const handleClick = () => {
if (isConnected) {
disconnect();
} else {
setConnectDialog(true);
}
};
return (
<button
onClick={handleClick}
className="ml-auto inline-block text-ui sm:text-body-large"
>
{isConnected ? t('Disconnect Vega wallet') : t('Connect Vega wallet')}
</button>
);
};