File tree Expand file tree Collapse file tree 2 files changed +54
-77
lines changed Expand file tree Collapse file tree 2 files changed +54
-77
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { Fragment } from 'react' ;
2+
13import { getCurrentPlatform } from 'sentry-docs/docTree' ;
24import { serverContext } from 'sentry-docs/serverContext' ;
35import { PlatformCategory } from 'sentry-docs/types' ;
46
57import { Expandable } from './expandable' ;
68import { codeToJsx } from './highlightCode' ;
7- import { RenderNestedObject } from './nestedObject' ;
89import { SdkDefinition } from './sdkDefinition' ;
910import { getPlatformHints } from './sdkOption' ;
1011
@@ -103,3 +104,55 @@ function ApiParameterDef({
103104 </ div >
104105 ) ;
105106}
107+
108+ function RenderNestedObject ( {
109+ name,
110+ objProps,
111+ language,
112+ } : {
113+ language : string ;
114+ objProps : ParameterDef [ ] ;
115+ name ?: string ;
116+ } ) {
117+ // NOTE: For now, we always render the nested object in typescript
118+
119+ return (
120+ < div >
121+ < div >
122+ < code >
123+ { name ? name : 'Object' } { '{' }
124+ </ code >
125+ </ div >
126+
127+ < div className = "flex flex-col gap-2 pl-4" >
128+ { objProps . map ( prop => (
129+ < div key = { prop . name } >
130+ { prop . description && (
131+ < div >
132+ < code > { codeToJsx ( `// ${ prop . description } ` , 'typescript' ) } </ code >
133+ </ div >
134+ ) }
135+ < div >
136+ { typeof prop . type === 'string' ? (
137+ < Fragment >
138+ < code >
139+ { prop . name }
140+ { ! prop . required ? '?' : '' } :{ ' ' }
141+ </ code >
142+ < code > { codeToJsx ( prop . type , 'typescript' ) } ,</ code >
143+ </ Fragment >
144+ ) : (
145+ < RenderNestedObject
146+ name = { `${ prop . name } ${ ! prop . required ? '?' : '' } : ${ prop . type . name || 'Object' } ` }
147+ objProps = { prop . type . properties }
148+ language = { language }
149+ />
150+ ) }
151+ </ div >
152+ </ div >
153+ ) ) }
154+ </ div >
155+ < div > { '}' } </ div >
156+ </ div >
157+ ) ;
158+ }
You can’t perform that action at this time.
0 commit comments