chore: minor refactor

This commit is contained in:
Roman Hotsiy 2019-03-15 17:20:20 +02:00
parent b21cd3d366
commit dc77d8f25e
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -20,16 +20,17 @@ export interface ExtensionsProps {
export class Extensions extends React.PureComponent<ExtensionsProps> {
render() {
const exts = this.props.extensions;
return (
<OptionsContext.Consumer>
{options => (
<>
{options.showExtensions &&
Object.keys(this.props.extensions).map(key => (
Object.keys(exts).map(key => (
<Extension key={key}>
<FieldLabel> {key.substring(2)}: </FieldLabel>{' '}
<ExtensionValue>
{JSON.stringify(this.props.extensions[key]).replace(/(^")|("$)/g, '')}
{typeof exts[key] === 'string' ? exts[key] : JSON.stringify(exts[key])}
</ExtensionValue>
</Extension>
))}