Allow raw display of non-decodable inputs

This commit is contained in:
Willian Mitsuda 2021-11-08 14:53:23 -03:00
parent b9a9495c61
commit d905afd75d
3 changed files with 13 additions and 6 deletions

View File

@ -1,13 +1,20 @@
import React from "react";
import { Tab } from "@headlessui/react";
const ModeTab: React.FC = ({ children }) => (
type ModeTabProps = {
disabled?: boolean | undefined;
};
const ModeTab: React.FC<ModeTabProps> = ({ disabled, children }) => (
<Tab
className={({ selected }) =>
`border rounded-lg px-2 py-1 bg-gray-100 hover:bg-gray-200 hover:shadow text-xs text-gray-500 hover:text-gray-600 ${
selected ? "border-blue-300" : ""
}`
`border rounded-lg px-2 py-1 bg-gray-100 ${
disabled
? "text-gray-300"
: "hover:bg-gray-200 hover:shadow text-gray-500 hover:text-gray-600"
} text-xs ${selected ? "border-blue-300" : ""}`
}
disabled={disabled}
>
{children}
</Tab>

View File

@ -72,7 +72,7 @@ const TraceInput: React.FC<TraceInputProps> = ({
{(!hasParams || !expanded) && <>)</>}
</span>
</div>
{hasParams && expanded && fourBytesTxDesc && (
{hasParams && expanded && (
<>
<div className="ml-5 mr-1 my-2">
<InputDecoder

View File

@ -39,7 +39,7 @@ const InputDecoder: React.FC<InputDecoderProps> = ({
return (
<Tab.Group>
<Tab.List className="flex space-x-1 mb-1">
<ModeTab>Decoded</ModeTab>
<ModeTab disabled={!resolvedTxDesc}>Decoded</ModeTab>
<ModeTab>Raw</ModeTab>
<ModeTab>UTF-8</ModeTab>
</Tab.List>