-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f43dd1
commit da0f010
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ar-website/src/components/RegistrationCard/DisplayRegistration/EASScanLink/EAScanLink.css
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,3 @@ | ||
.etherscan-link { | ||
display: inline-block; | ||
} |
55 changes: 55 additions & 0 deletions
55
...tar-website/src/components/RegistrationCard/DisplayRegistration/EASScanLink/EAScanLink.js
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,55 @@ | ||
import React from 'react'; | ||
import { Icon } from '@blueprintjs/core'; | ||
import { Tooltip2 } from '@blueprintjs/popover2'; | ||
import './EAScanLink.css'; | ||
|
||
const EtherscanLink = ({ | ||
address, | ||
network = 'ethereum' // default network is ethereum | ||
}) => { | ||
|
||
const getUrl = (network, address) => { | ||
switch (network) { | ||
case 'optimism': | ||
return `https://optimism.easscan.org/schema/view/`; | ||
case 'arbitrum-one': | ||
return `https://arbitrum.easscan.org/schema/view/`; | ||
case 'arbitrum-nova': | ||
return `https://arbitrum-nova.easscan.org/`; | ||
case 'ethereum': | ||
default: | ||
return `https://easscan.org/schema/view/`; | ||
} | ||
}; | ||
|
||
const url = getUrl(network, address); | ||
|
||
return ( | ||
<div className='etherscan-link'> | ||
<a | ||
href={url} | ||
className='no-underline' | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{address} | ||
<Tooltip2 | ||
content={`View on ${network === 'optimism' ? 'Optimistic Etherscan' : 'Etherscan'}`} | ||
placement='top' | ||
> | ||
<Icon | ||
style={{ | ||
marginLeft: 4, | ||
position: 'relative', | ||
top: -2 | ||
}} | ||
icon='link' | ||
size={10} | ||
/> | ||
</Tooltip2> | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EtherscanLink; |