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