Skip to content

Commit

Permalink
fix: tidy up non-redoc vendor extension presentation (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
drjonnicholson authored and RomanHotsiy committed Mar 15, 2019
1 parent 26f6b3d commit b21cd3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/common-elements/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => `
Expand Down
14 changes: 7 additions & 7 deletions src/components/Fields/Extensions.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import * as React from 'react';

import { ExtensionValue, FieldLabel } from '../../common-elements/fields';

import styled from '../../styled-components';

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;
Expand All @@ -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>
))}
</>
Expand Down

0 comments on commit b21cd3d

Please sign in to comment.