-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from makerdao/develop
0.2.6
- Loading branch information
Showing
34 changed files
with
598 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
|
||
import lang from 'languages'; | ||
import styled from 'styled-components'; | ||
|
||
import { useNavigation } from 'react-navi'; | ||
import { Button, Flex } from '@makerdao/ui-components-core'; | ||
import { ReactComponent as MetaMaskLogo } from 'images/metamask.svg'; | ||
import { ReactComponent as TrustLogo } from 'images/trust-logo.svg'; | ||
import { ReactComponent as ImTokenLogo } from 'images/imtoken-logo.svg'; | ||
import coinbaseWalletLogo from 'images/coinbase-wallet.png'; | ||
import alphaWalletLogo from 'images/alpha-wallet-logo.png'; | ||
import useMaker from 'hooks/useMaker'; | ||
import { wallets } from 'utils/web3'; | ||
|
||
// hack to get around button padding for now | ||
const MMLogo = styled(MetaMaskLogo)` | ||
margin-top: -5px; | ||
margin-bottom: -5px; | ||
`; | ||
|
||
export default function BrowserProviderConnect({ provider }) { | ||
const { | ||
authenticated: makerAuthenticated, | ||
connectBrowserProvider | ||
} = useMaker(); | ||
const navigation = useNavigation(); | ||
|
||
return ( | ||
<Button | ||
variant="secondary-outline" | ||
width="225px" | ||
disabled={!makerAuthenticated} | ||
onClick={async () => { | ||
try { | ||
const connectedAddress = await connectBrowserProvider(); | ||
|
||
const { search } = (await navigation.getRoute()).url; | ||
|
||
navigation.navigate({ | ||
pathname: `owner/${connectedAddress}`, | ||
search | ||
}); | ||
} catch (err) { | ||
window.alert(err); | ||
} | ||
}} | ||
> | ||
<Flex alignItems="center"> | ||
{provider === wallets.METAMASK && <MMLogo />} | ||
{provider === wallets.TRUST && <TrustLogo width="20px" height="20px" />} | ||
{provider === wallets.IMTOKEN && ( | ||
<ImTokenLogo | ||
css={` | ||
pointer-events: none; | ||
`} | ||
width="20px" | ||
height="20px" | ||
/> | ||
)} | ||
{provider === wallets.COINBASE && ( | ||
<img src={coinbaseWalletLogo} width="20px" height="20px" alt="" /> | ||
)} | ||
{provider === wallets.ALPHA && ( | ||
<img src={alphaWalletLogo} width="20px" height="20px" alt="" /> | ||
)} | ||
<span style={{ margin: 'auto' }}> | ||
{lang.landing_page[provider] || 'Active Wallet'} | ||
</span> | ||
</Flex> | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.