otterscan/src/components/MethodName.tsx

25 lines
592 B
TypeScript
Raw Normal View History

import React from "react";
2021-12-16 22:12:55 +00:00
import { useMethodSelector } from "../use4Bytes";
2021-07-01 18:21:40 +00:00
type MethodNameProps = {
data: string;
};
const MethodName: React.FC<MethodNameProps> = ({ data }) => {
2021-12-16 22:12:55 +00:00
const [isSimpleTransfer, methodName, methodTitle] = useMethodSelector(data);
2021-07-01 18:21:40 +00:00
return (
<div
className={`${
isSimpleTransfer ? "bg-yellow-100" : "bg-blue-50"
} rounded-lg px-3 py-1 min-h-full flex items-baseline text-xs max-w-max`}
>
<p className="truncate" title={methodTitle}>
{methodName}
2021-07-01 18:21:40 +00:00
</p>
</div>
);
};
export default React.memo(MethodName);