@@ -3,12 +3,12 @@ import { Icon } from '@gitbook/icons';
33import { OpenAPIOperation } from '@gitbook/react-openapi' ;
44import React from 'react' ;
55
6- import { LoadingPane } from '@/components/primitives' ;
76import { fetchOpenAPIBlock } from '@/lib/openapi/fetch' ;
87import { tcls } from '@/lib/tailwind' ;
98
109import { BlockProps } from '../Block' ;
1110import { PlainCodeBlock } from '../CodeBlock' ;
11+ import { Heading } from '../Heading' ;
1212
1313import './style.css' ;
1414import './scalar.css' ;
@@ -54,6 +54,31 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockOpenAPI>) {
5454 plus : < Icon icon = "plus" /> ,
5555 } ,
5656 CodeBlock : PlainCodeBlock ,
57+ renderHeading : ( headingProps ) => (
58+ < Heading
59+ document = { props . document }
60+ ancestorBlocks = { props . ancestorBlocks }
61+ isEstimatedOffscreen = { props . isEstimatedOffscreen }
62+ context = { props . context }
63+ style = { headingProps . deprecated ? 'line-through' : undefined }
64+ block = { {
65+ object : 'block' ,
66+ key : `${ block . key } -heading` ,
67+ meta : block . meta ,
68+ data : { } ,
69+ type : 'heading-2' ,
70+ nodes : [
71+ {
72+ key : `${ block . key } -heading-text` ,
73+ object : 'text' ,
74+ leaves : [
75+ { text : headingProps . title , object : 'leaf' , marks : [ ] } ,
76+ ] ,
77+ } ,
78+ ] ,
79+ } }
80+ />
81+ ) ,
5782 defaultInteractiveOpened : context . mode === 'print' ,
5883 id : block . meta ?. id ,
5984 blockKey : block . key ,
@@ -62,32 +87,3 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockOpenAPI>) {
6287 />
6388 ) ;
6489}
65-
66- function OpenAPIFallback ( ) {
67- return (
68- < div
69- role = "status"
70- aria-busy
71- className = { 'openapi-block ' + tcls ( 'flex' , 'flex-1' , 'flex-col' , 'gap-3' ) }
72- >
73- < LoadingPane
74- tile = { 12 }
75- style = { [ 'rounded-md' , 'h-[47px]' , '[max-width:calc(48rem-1px)]' ] }
76- />
77- < LoadingPane
78- tile = { 12 }
79- style = { [ 'rounded-md' , 'h-[35px]' , '[max-width:calc(48rem-1px)]' ] }
80- />
81- < div className = { tcls ( 'flex' , 'gap-[25px]' ) } >
82- < div className = { tcls ( 'flex' , 'flex-1' , 'flex-col' , 'gap-3' ) } >
83- < LoadingPane tile = { 24 } style = { [ 'rounded-md' , 'aspect-[2.5/1]' , 'w-full' ] } />
84- < LoadingPane tile = { 24 } style = { [ 'rounded-md' , 'aspect-[2.5/1]' , 'w-full' ] } />
85- </ div >
86- < div className = { tcls ( 'flex' , 'flex-1' , 'flex-col' , 'gap-3' ) } >
87- < LoadingPane tile = { 24 } style = { [ 'rounded-md' , 'aspect-[4/1]' , 'w-full' ] } />
88- < LoadingPane tile = { 24 } style = { [ 'rounded-md' , 'aspect-[4/1]' , 'w-full' ] } />
89- </ div >
90- </ div >
91- </ div >
92- ) ;
93- }
0 commit comments