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')}; ${extensionsHook('ExampleValue')};
`; `;
export const ExtensionValue = styled(ExampleValue)``;
export const ConstraintItem = styled(FieldLabel)` export const ConstraintItem = styled(FieldLabel)`
border-radius: 2px; border-radius: 2px;
${({ theme }) => ` ${({ theme }) => `

View File

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