Add hyperlinks to EIP tx types

This commit is contained in:
Willian Mitsuda 2021-07-28 16:27:06 -03:00
parent eaa018e207
commit 873541ec64
2 changed files with 35 additions and 3 deletions

View File

@ -0,0 +1,23 @@
import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
type ExternalLinkProps = {
href: string;
};
const ExternalLink: React.FC<ExternalLinkProps> = ({ href, children }) => (
<a
className="text-link-blue hover:text-link-blue-hover"
href={href}
target="_blank"
rel="noopener noreferrer"
>
<span className="inline-flex items-center space-x-1">
<span>{children}</span>
<FontAwesomeIcon icon={faExternalLinkAlt} size="1x" />
</span>
</a>
);
export default ExternalLink;

View File

@ -1,20 +1,29 @@
import React from "react";
import ExternalLink from "./ExternalLink";
type TransactionTypeProps = {
type: number;
};
const TransactionType: React.FC<TransactionTypeProps> = ({ type }) => {
let description: string;
let description: React.ReactNode;
switch (type) {
case 0:
description = "legacy";
break;
case 1:
description = "EIP-2930";
description = (
<ExternalLink href="https://eips.ethereum.org/EIPS/eip-2930">
EIP-2930
</ExternalLink>
);
break;
case 2:
description = "EIP-1559";
description = (
<ExternalLink href="https://eips.ethereum.org/EIPS/eip-1559">
EIP-1559
</ExternalLink>
);
break;
default:
description = "unknown";