Skip to content

Commit

Permalink
use NewTabLink in Web3.tsx, allow NewTabLink to accept className
Browse files Browse the repository at this point in the history
  • Loading branch information
skubakdj committed Oct 26, 2017
1 parent bc4b801 commit f02f884
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 4 additions & 6 deletions common/components/WalletDecrypt/Web3.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import translate from 'translations';
import { NewTabLink } from 'components/ui';
import './Web3.scss';

interface Props {
Expand All @@ -20,14 +21,11 @@ export default class Web3Decrypt extends Component<Props> {
</div>

<div>
<a
<NewTabLink
className="Web3Decrypt-install btn btn-sm btn-default"
content={translate('Download MetaMask')}
href="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en"
target="_blank"
rel="noopener"
>
{translate('Download MetaMask')}
</a>
/>
</div>
</section>
);
Expand Down
8 changes: 5 additions & 3 deletions common/components/ui/NewTabLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';

interface AAttributes {
charset?: string;
className?: string;
coords?: string;
download?: string;
href: string;
Expand All @@ -28,14 +29,15 @@ interface AAttributes {
type?: string;
}

interface NewTabLinkProps extends AAttributes {
interface NewTabLinkProps extends AAttributes {
content?: React.ReactElement<any> | string;
children?: React.ReactElement<any> | string;
}

const NewTabLink = ({ content, children, ...rest }: NewTabLinkProps) =>
const NewTabLink = ({ content, children, ...rest }: NewTabLinkProps) => (
<a target="_blank" rel="noopener" {...rest}>
{content || children} {/* Keep content for short-hand text insertion */}
</a>;
</a>
);

export default NewTabLink;

0 comments on commit f02f884

Please sign in to comment.