Skip to content

Commit 6fdedf3

Browse files
committed
Fix type error
1 parent c12f5f8 commit 6fdedf3

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

Diff for: packages/react-openapi/src/schemas/OpenAPISchemas.tsx

+18-16
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
getOpenAPIClientContext,
1010
resolveOpenAPIContext,
1111
} from '../context';
12-
import { t } from '../translate';
12+
import { t, tString } from '../translate';
1313
import { getExampleFromSchema } from '../util/example';
1414

1515
/**
@@ -85,21 +85,23 @@ export function OpenAPISchemas(props: {
8585
<div className={clsx('openapi-schemas', className)}>
8686
{schemas.map(({ name, schema }) => {
8787
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>
103105
);
104106
})}
105107
</div>

0 commit comments

Comments
 (0)