Apply selection highlighter to function sigs

This commit is contained in:
Willian Mitsuda 2021-10-28 02:59:50 -03:00
parent f800f05787
commit 05953de053
2 changed files with 21 additions and 10 deletions

View File

@ -18,6 +18,8 @@ export const genericSelector =
selection.content === content;
export const addressSelector: ContentSelector = genericSelector("address");
export const functionSigSelector: ContentSelector =
genericSelector("functionSig");
type SelectionHighlighterProps = React.PropsWithChildren<{
myType: SelectionType;

View File

@ -1,4 +1,7 @@
import React from "react";
import SelectionHighlighter, {
functionSigSelector,
} from "../components/SelectionHighlighter";
type FunctionSignatureProps = {
callType: string;
@ -9,17 +12,23 @@ const FunctionSignature: React.FC<FunctionSignatureProps> = ({
callType,
sig,
}) => (
<span
className={`font-bold ${
callType === "STATICCALL"
? "text-red-700"
: callType === "DELEGATECALL" || callType === "CALLCODE"
? "text-gray-400"
: "text-blue-900"
}`}
<SelectionHighlighter
myType="functionSig"
myContent={sig}
selector={functionSigSelector}
>
{sig}
</span>
<span
className={`font-bold ${
callType === "STATICCALL"
? "text-red-700"
: callType === "DELEGATECALL" || callType === "CALLCODE"
? "text-gray-400"
: "text-blue-900"
}`}
>
{sig}
</span>
</SelectionHighlighter>
);
export default FunctionSignature;