mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-23 02:54:12 +03:00
chore: minor refactor
This commit is contained in:
parent
b21cd3d366
commit
dc77d8f25e
|
@ -20,16 +20,17 @@ export interface ExtensionsProps {
|
||||||
|
|
||||||
export class Extensions extends React.PureComponent<ExtensionsProps> {
|
export class Extensions extends React.PureComponent<ExtensionsProps> {
|
||||||
render() {
|
render() {
|
||||||
|
const exts = this.props.extensions;
|
||||||
return (
|
return (
|
||||||
<OptionsContext.Consumer>
|
<OptionsContext.Consumer>
|
||||||
{options => (
|
{options => (
|
||||||
<>
|
<>
|
||||||
{options.showExtensions &&
|
{options.showExtensions &&
|
||||||
Object.keys(this.props.extensions).map(key => (
|
Object.keys(exts).map(key => (
|
||||||
<Extension key={key}>
|
<Extension key={key}>
|
||||||
<FieldLabel> {key.substring(2)}: </FieldLabel>{' '}
|
<FieldLabel> {key.substring(2)}: </FieldLabel>{' '}
|
||||||
<ExtensionValue>
|
<ExtensionValue>
|
||||||
{JSON.stringify(this.props.extensions[key]).replace(/(^")|("$)/g, '')}
|
{typeof exts[key] === 'string' ? exts[key] : JSON.stringify(exts[key])}
|
||||||
</ExtensionValue>
|
</ExtensionValue>
|
||||||
</Extension>
|
</Extension>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user