vega-frontend-monorepo/apps/trading/components/vega-wallet-connect-button/index.tsx
Bartłomiej Głownia 8a829964be
Feature/38 data grid component (#77)
* Add ag-grid

* Add lazy loaded ag-grid component

* Add theme context, move VegaWallet to separate lib

* Fix trading app cypress configuration

* Lazy load ag-grid theme css files

* Encapsulate theme switch hook
2022-03-14 14:18:11 +01:00

27 lines
607 B
TypeScript

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">
{isConnected ? 'Disconnect' : 'Connect Vega wallet'}
</button>
);
};