File tree Expand file tree Collapse file tree 1 file changed +41
-5
lines changed
packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Response Expand file tree Collapse file tree 1 file changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -81,12 +81,48 @@ function Response() {
8181 </ button >
8282 </ div >
8383 </ summary >
84- < CodeBlock
85- language = { response . startsWith ( "<" ) ? `xml` : `json` }
86- className = "openapi-demo__code-block"
84+ < div
85+ style = { {
86+ backgroundColor : prismTheme . plain . backgroundColor ,
87+ paddingLeft : "1rem" ,
88+ paddingTop : "1rem" ,
89+ ...( ( prettyResponse === "Fetching..." || ! code ) && {
90+ paddingBottom : "1rem" ,
91+ } ) ,
92+ } }
8793 >
88- { prettyResponse || "No Response" }
89- </ CodeBlock >
94+ { code && prettyResponse !== "Fetching..." ? (
95+ < SchemaTabs lazy >
96+ { /* @ts -ignore */ }
97+ < TabItem
98+ label = { ` ${ code } ` }
99+ value = "body"
100+ attributes = { {
101+ className : clsx ( "openapi-response__dot" , responseStatusClass ) ,
102+ } }
103+ default
104+ >
105+ < CodeBlock
106+ className = "openapi-demo__code-block openapi-response__status-code"
107+ language = { response . startsWith ( "<" ) ? `xml` : `json` }
108+ >
109+ { prettyResponse || "No Response" }
110+ </ CodeBlock >
111+ </ TabItem >
112+ { /* @ts -ignore */ }
113+ < TabItem label = "Headers" value = "headers" >
114+ < CodeBlock
115+ className = "openapi-demo__code-block openapi-response__status-headers"
116+ language = { response . startsWith ( "<" ) ? `xml` : `json` }
117+ >
118+ { JSON . stringify ( headers , undefined , 2 ) }
119+ </ CodeBlock >
120+ </ TabItem >
121+ </ SchemaTabs >
122+ ) : (
123+ prettyResponse || "No Response"
124+ ) }
125+ </ div >
90126 </ details >
91127 ) ;
92128}
You can’t perform that action at this time.
0 commit comments