Skip to content

Commit 9b2480a

Browse files
authored
[UI Enhancement] Enable Expand button for Response (#553)
* Use ApiCodeBlock for Response * Fix linter errors
1 parent 920e24e commit 9b2480a

File tree

1 file changed

+7
-5
lines changed
  • packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Response

1 file changed

+7
-5
lines changed

packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Response/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import React from "react";
1010
import { usePrismTheme } from "@docusaurus/theme-common";
1111
import { useDoc } from "@docusaurus/theme-common/internal";
1212
import { Loading } from "@nextui-org/react";
13+
import ApiCodeBlock from "@theme/ApiDemoPanel/ApiCodeBlock";
1314
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
14-
import CodeBlock from "@theme/CodeBlock";
1515
import SchemaTabs from "@theme/SchemaTabs";
1616
import TabItem from "@theme/TabItem";
1717
import clsx from "clsx";
@@ -108,7 +108,8 @@ function Response({ item }: { item: NonNullable<ApiItem> }) {
108108
}}
109109
default
110110
>
111-
<CodeBlock
111+
{/* @ts-ignore */}
112+
<ApiCodeBlock
112113
className="openapi-demo__code-block openapi-response__status-code"
113114
language={response.startsWith("<") ? `xml` : `json`}
114115
>
@@ -118,16 +119,17 @@ function Response({ item }: { item: NonNullable<ApiItem> }) {
118119
the response here!
119120
</p>
120121
)}
121-
</CodeBlock>
122+
</ApiCodeBlock>
122123
</TabItem>
123124
{/* @ts-ignore */}
124125
<TabItem label="Headers" value="headers">
125-
<CodeBlock
126+
{/* @ts-ignore */}
127+
<ApiCodeBlock
126128
className="openapi-demo__code-block openapi-response__status-headers"
127129
language={response.startsWith("<") ? `xml` : `json`}
128130
>
129131
{JSON.stringify(headers, undefined, 2)}
130-
</CodeBlock>
132+
</ApiCodeBlock>
131133
</TabItem>
132134
</SchemaTabs>
133135
) : prettyResponse === "Fetching..." ? (

0 commit comments

Comments
 (0)