Skip to content

Commit f42790f

Browse files
feat(ref): act-1516 - added extra content prop to parser (#1521)
1 parent c9d3c43 commit f42790f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/components/ParserOpenRPC/DetailsBox/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface DetailsBoxProps {
2222
components: SchemaComponents;
2323
result: any;
2424
tags: TagItem[];
25+
extraContent?: JSX.Element;
2526
}
2627

2728
export default function DetailsBox({
@@ -31,6 +32,7 @@ export default function DetailsBox({
3132
components,
3233
result,
3334
tags,
35+
extraContent,
3436
}: DetailsBoxProps) {
3537
return (
3638
<>
@@ -45,6 +47,7 @@ export default function DetailsBox({
4547
)}
4648
<Heading as="h1">{method}</Heading>
4749
<MDContent content={description} />
50+
{extraContent && <div className="padding-top--lg">{extraContent}</div>}
4851
<Heading
4952
as="h2"
5053
className={clsx(

src/components/ParserOpenRPC/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { MetamaskProviderContext } from "@site/src/theme/Root";
1717
interface ParserProps {
1818
network: NETWORK_NAMES;
1919
method?: string;
20+
extraContent?: JSX.Element;
2021
}
2122

2223
interface ParserOpenRPCContextProps {
@@ -30,7 +31,7 @@ interface ParserOpenRPCContextProps {
3031
export const ParserOpenRPCContext =
3132
createContext<ParserOpenRPCContextProps | null>(null);
3233

33-
export default function ParserOpenRPC({ network, method }: ParserProps) {
34+
export default function ParserOpenRPC({ network, method, extraContent }: ParserProps) {
3435
if (!method || !network) return null;
3536
const [isModalOpen, setModalOpen] = useState(false);
3637
const [reqResult, setReqResult] = useState(undefined);
@@ -178,6 +179,7 @@ export default function ParserOpenRPC({ network, method }: ParserProps) {
178179
components={currentMethodData.components.schemas}
179180
result={currentMethodData.result}
180181
tags={currentMethodData.tags}
182+
extraContent={extraContent}
181183
/>
182184
<ErrorsBox errors={currentMethodData.errors} />
183185
</div>

wallet/reference/new-reference.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@ sidebar_class_name: "hidden"
77

88
import ParserOpenRPC from "@site/src/components/ParserOpenRPC"
99
import { NETWORK_NAMES } from "@site/src/plugins/plugin-json-rpc"
10+
import Description from "@site/services/reference/_partials/_eth_sendtransaction-description.mdx"
1011

11-
<ParserOpenRPC network={NETWORK_NAMES.metamask} method="eth_requestAccounts" />
12+
<ParserOpenRPC
13+
network={NETWORK_NAMES.metamask}
14+
method="eth_requestAccounts"
15+
extraContent={<Description />}
16+
/>

0 commit comments

Comments
 (0)