Skip to content

Commit

Permalink
fix: remove 3rd party notification from link to explorer, closes #937
Browse files Browse the repository at this point in the history
  • Loading branch information
gitjeff05 authored and kyranjamie committed Nov 8, 2021
1 parent 0086913 commit 57e3dab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/components/home/balance-card.tsx
Expand Up @@ -7,7 +7,7 @@ import { toHumanReadableStx } from '@utils/unit-convert';
import { safeAwait } from '@utils/safe-await';
import { delay } from '@utils/delay';

import { ExternalLink } from '@components/external-link';
import { InternalLink } from '@components/internal-link';
import { makeExplorerAddressLink } from '@utils/external-links';
import { isTestnet } from '@utils/network-utils';
import { useBalance } from '@hooks/use-balance';
Expand Down Expand Up @@ -46,9 +46,9 @@ export const BalanceCard: FC<BalanceCardProps> = props => {
</Text>

{address !== null && (
<ExternalLink href={makeExplorerAddressLink(address)} textStyle="caption" ml="tight">
<InternalLink href={makeExplorerAddressLink(address)} textStyle="caption" ml="tight">
View on Explorer
</ExternalLink>
</InternalLink>
)}
</Flex>
<Title fontSize="40px" lineHeight="56px">
Expand Down
30 changes: 30 additions & 0 deletions app/components/internal-link.tsx
@@ -0,0 +1,30 @@
import React, { FC } from 'react';
import { Box, Text, BoxProps, color } from '@stacks/ui';
import { openExternalLink } from '@utils/external-links';

interface InternalLinkProps extends BoxProps {
href: string;
}

export const InternalLink: FC<InternalLinkProps> = ({ href, children, ...props }) => {
const openUrl = () => openExternalLink(href);
return (
<Text
onClick={openUrl}
as="button"
type="button"
cursor="pointer"
display="block"
outline={0}
color={color('brand')}
_hover={{ textDecoration: 'underline' }}
_focus={{ textDecoration: 'underline' }}
{...props}
>
{children}
<Box display="inline-block" ml="extra-tight" mb="1px">
</Box>
</Text>
);
};

0 comments on commit 57e3dab

Please sign in to comment.