@@ -3,12 +3,12 @@ import { Icon } from '@gitbook/icons';
3
3
import { OpenAPIOperation } from '@gitbook/react-openapi' ;
4
4
import React from 'react' ;
5
5
6
- import { LoadingPane } from '@/components/primitives' ;
7
6
import { fetchOpenAPIBlock } from '@/lib/openapi/fetch' ;
8
7
import { tcls } from '@/lib/tailwind' ;
9
8
10
9
import { BlockProps } from '../Block' ;
11
10
import { PlainCodeBlock } from '../CodeBlock' ;
11
+ import { Heading } from '../Heading' ;
12
12
13
13
import './style.css' ;
14
14
import './scalar.css' ;
@@ -54,6 +54,31 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockOpenAPI>) {
54
54
plus : < Icon icon = "plus" /> ,
55
55
} ,
56
56
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
+ ) ,
57
82
defaultInteractiveOpened : context . mode === 'print' ,
58
83
id : block . meta ?. id ,
59
84
blockKey : block . key ,
@@ -62,32 +87,3 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockOpenAPI>) {
62
87
/>
63
88
) ;
64
89
}
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