mango-v4-ui/components/shared/ExplorerLink.tsx

31 lines
747 B
TypeScript
Raw Normal View History

2022-12-08 19:07:28 -08:00
import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid'
2022-12-08 14:13:06 -08:00
import { CLUSTER } from '@store/mangoStore'
2022-05-03 21:20:14 -07:00
type ExplorerLinkProps = {
address: string
2022-12-08 14:13:06 -08:00
anchorData?: boolean
className?: string
2022-05-03 21:20:14 -07:00
}
2022-12-08 14:13:06 -08:00
const ExplorerLink = ({
address,
anchorData = false,
className = '',
}: ExplorerLinkProps) => {
2022-05-03 21:20:14 -07:00
return (
<a
2022-12-08 14:13:06 -08:00
href={`https://explorer.solana.com/address/${address}${
anchorData ? '/anchor-account' : ''
}?cluster=${CLUSTER}`}
2022-12-08 19:07:28 -08:00
className={`flex items-center break-all text-th-fgd-2 hover:text-th-fgd-3 ${className}`}
2022-05-03 21:20:14 -07:00
target="_blank"
rel="noreferrer"
>
{address}
2022-12-08 19:07:28 -08:00
<ArrowTopRightOnSquareIcon className="ml-2 h-5 w-5 whitespace-nowrap" />
2022-05-03 21:20:14 -07:00
</a>
)
}
export default ExplorerLink