fix: tidy up non-redoc vendor extension presentation (#847)

This commit is contained in:
Jon Nicholson 2019-03-15 15:15:06 +00:00 committed by Roman Hotsiy
parent 26f6b3d5c9
commit b21cd3d366
2 changed files with 9 additions and 7 deletions

View File

@ -88,6 +88,8 @@ export const ExampleValue = styled(FieldLabel)`
${extensionsHook('ExampleValue')};
`;
export const ExtensionValue = styled(ExampleValue)``;
export const ConstraintItem = styled(FieldLabel)`
border-radius: 2px;
${({ theme }) => `

View File

@ -1,4 +1,7 @@
import * as React from 'react';
import { ExtensionValue, FieldLabel } from '../../common-elements/fields';
import styled from '../../styled-components';
import { OptionsContext } from '../OptionsProvider';
@ -6,14 +9,9 @@ import { OptionsContext } from '../OptionsProvider';
import { StyledMarkdownBlock } from '../Markdown/styled.elements';
const Extension = styled(StyledMarkdownBlock)`
opacity: 0.9;
margin: 2px 0;
`;
const ExtensionLable = styled.span`
font-style: italic;
`;
export interface ExtensionsProps {
extensions: {
[k: string]: any;
@ -29,8 +27,10 @@ export class Extensions extends React.PureComponent<ExtensionsProps> {
{options.showExtensions &&
Object.keys(this.props.extensions).map(key => (
<Extension key={key}>
<ExtensionLable>{key}</ExtensionLable>:{' '}
<code>{JSON.stringify(this.props.extensions[key])}</code>
<FieldLabel> {key.substring(2)}: </FieldLabel>{' '}
<ExtensionValue>
{JSON.stringify(this.props.extensions[key]).replace(/(^")|("$)/g, '')}
</ExtensionValue>
</Extension>
))}
</>