File tree 1 file changed +18
-16
lines changed
packages/react-openapi/src/schemas
1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change 9
9
getOpenAPIClientContext ,
10
10
resolveOpenAPIContext ,
11
11
} from '../context' ;
12
- import { t } from '../translate' ;
12
+ import { t , tString } from '../translate' ;
13
13
import { getExampleFromSchema } from '../util/example' ;
14
14
15
15
/**
@@ -85,21 +85,23 @@ export function OpenAPISchemas(props: {
85
85
< div className = { clsx ( 'openapi-schemas' , className ) } >
86
86
{ schemas . map ( ( { name, schema } ) => {
87
87
return (
88
- < >
89
- OpenAPISchemas
90
- < OpenAPIDisclosure
91
- className = "openapi-schemas-disclosure"
92
- key = { name }
93
- icon = { context . icons . chevronRight }
94
- label = { name }
95
- >
96
- < Section className = "openapi-section-schemas" >
97
- < SectionBody >
98
- < OpenAPIRootSchema schema = { schema } context = { clientContext } />
99
- </ SectionBody >
100
- </ Section >
101
- </ OpenAPIDisclosure >
102
- </ >
88
+ < OpenAPIDisclosure
89
+ className = "openapi-schemas-disclosure"
90
+ key = { name }
91
+ icon = { context . icons . chevronRight }
92
+ header = { name }
93
+ label = { ( isExpanded ) =>
94
+ isExpanded
95
+ ? tString ( context . translation , 'hide' )
96
+ : tString ( context . translation , 'show' )
97
+ }
98
+ >
99
+ < Section className = "openapi-section-schemas" >
100
+ < SectionBody >
101
+ < OpenAPIRootSchema schema = { schema } context = { clientContext } />
102
+ </ SectionBody >
103
+ </ Section >
104
+ </ OpenAPIDisclosure >
103
105
) ;
104
106
} ) }
105
107
</ div >
You can’t perform that action at this time.
0 commit comments