Add support for switching between source files

This commit is contained in:
Willian Mitsuda 2021-07-24 20:47:09 -03:00
parent f15c75bb8e
commit 4adace4913

View File

@ -71,15 +71,20 @@ const Contracts: React.FC<ContractsProps> = ({ checksummedAddress }) => {
)} )}
{rawMetadata !== undefined && rawMetadata !== null && ( {rawMetadata !== undefined && rawMetadata !== null && (
<div> <div>
<div className="flex truncate">
{Object.entries(rawMetadata.sources).map(([k]) => ( {Object.entries(rawMetadata.sources).map(([k]) => (
<button <button
className={`border-b-2 border-transparent rounded-t text-sm px-2 py-1 bg-gray-200 text-gray-500 ${ className={`border-b-2 border-transparent rounded-t text-sm px-2 py-1 ${
selected === k ? "border-orange-300 font-bold" : "" selected === k
? "border-orange-300 font-bold bg-gray-200 text-gray-500"
: "bg-gray-100 text-gray-400 transform origin-bottom scale-95"
}`} }`}
onClick={() => setSelected(k)}
> >
{k} {k}
</button> </button>
))} ))}
</div>
{selected && ( {selected && (
<Contract <Contract
checksummedAddress={checksummedAddress} checksummedAddress={checksummedAddress}