Skip to content

Commit 19e2346

Browse files
committed
style: final touches
1 parent df3ec9e commit 19e2346

File tree

7 files changed

+51
-24
lines changed

7 files changed

+51
-24
lines changed

.storybook/theme.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ export const zones = {
2727
},
2828

2929
types: {
30-
object: '#00f',
31-
array: '#008000',
32-
allOff: '#B8860B',
33-
oneOf: '#B8860B',
34-
anyOf: '#B8860B',
30+
object: '#83c1ff',
31+
array: '#7dff75',
32+
allOff: '#b89826',
33+
oneOf: '#b89826',
34+
anyOf: '#b89826',
3535
null: '#ff7f50',
36-
integer: '#a52a2a',
37-
number: '#a52a2a',
36+
integer: '#e03b36',
37+
number: '#e03b36',
3838
boolean: '#ff69b4',
39-
binary: '#66cdaa',
40-
string: '#008080',
41-
$ref: '#8a2be2',
39+
binary: '#8ccda3',
40+
string: '#19c5a0',
41+
$ref: '#a359e2',
4242
}
4343
} : {
4444
canvas: {
@@ -58,7 +58,6 @@ export const zones = {
5858
evenBg: '#e4e4e4',
5959
},
6060

61-
6261
types: {
6362
object: '#00f',
6463
array: '#008000',

src/PropValidations.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ISchema } from '@stoplight/types';
33
import * as React from 'react';
44
import { isCombiner } from './util/isCombiner';
55
import { pickValidations } from './util/pickValidations';
6+
import { MutedText } from './common/MutedText';
67

78
export const PropValidations: React.FunctionComponent<{ prop: ISchema }> = ({ prop }) => {
89
if (!isCombiner(prop)) {
@@ -22,15 +23,15 @@ export const PropValidations: React.FunctionComponent<{ prop: ISchema }> = ({ pr
2223
if (type === 'boolean') {
2324
return (
2425
<div key={k}>
25-
<b>{k}:</b> {v.toString()}
26+
<MutedText as="b">{k}:</MutedText> {v.toString()}
2627
</div>
2728
);
2829
}
2930

3031
if (type !== 'object') {
3132
return (
3233
<div key={k}>
33-
<b>{k}:</b> {v}
34+
<MutedText as="b">{k}:</MutedText> {v}
3435
</div>
3536
);
3637
}

src/__stories__/JsonSchemaViewer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import * as nestedSchema from './__fixtures__/nested-schema.json';
99

1010
storiesOf('JsonSchemaViewer', module)
1111
.addDecorator(withKnobs)
12-
.add('with text', () => (
12+
.add('default', () => (
1313
<JsonSchemaViewer
1414
css={{ fontFamily: 'monospace' }}
1515
name={text('name', 'name')}
1616
schemas={object('schemas', {})}
17-
schema={object('schema', schema)}
17+
schema={schema}
1818
limitPropertyCount={number('limitPropertyCount', 20)}
1919
hideRoot={boolean('hideRoot', false)}
2020
expanded={boolean('expanded', true)}
2121
/>
2222
))
23-
.add('with nested properties', () => (
23+
.add('custom schema', () => (
2424
<JsonSchemaViewer
2525
css={{ fontFamily: 'monospace' }}
2626
name={text('name', 'name')}

src/__stories__/__fixtures__/default-schema.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@
1111
"minimum": 0,
1212
"maximum": 150
1313
},
14-
"completed_at": {},
14+
"completed_at": {
15+
"type": "string",
16+
"format": "date-time"
17+
},
1518
"items": {
1619
"type": [
17-
"string",
20+
"null",
1821
"array"
1922
],
2023
"items": {
21-
"type": "string"
24+
"type": [
25+
"string",
26+
"number"
27+
]
2228
}
2329
},
2430
"email": {
@@ -50,6 +56,23 @@
5056
}
5157
}
5258
]
59+
},
60+
"permissions": {
61+
"type": [
62+
"string",
63+
"object"
64+
],
65+
"properties": {
66+
"ids": {
67+
"type": "array",
68+
"items": {
69+
"type": "integer"
70+
}
71+
}
72+
}
73+
},
74+
"ref": {
75+
"$ref": "#/definitions/error-response"
5376
}
5477
},
5578
"required": [

src/common/Row.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const rowStyles = ({ level }: IRowProps) => {
3232
},
3333
css`
3434
user-select none;
35+
line-height: 1rem;
3536
3637
&:nth-of-type(even) {
3738
background-color ${theme.row.evenBg};

src/renderers/renderAllOf.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface IRenderAllProps extends ICommonProps {
1111
export const renderAllOf = ({
1212
schemas,
1313
level,
14-
parentName,
1514
rowElems,
1615
props,
1716
toggleExpandRow,

src/renderers/renderProp.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ export const renderProp = ({
149149

150150
if (required || vt) {
151151
requiredElem = (
152-
<div>
152+
<Box fontSize="0.75rem">
153153
{showVt ? <MutedText as="span">{vt}</MutedText> : null}
154154
{showVt && required ? <MutedText as="span"> + </MutedText> : null}
155155
{required ? (
156156
<Box as="span" fontWeight={700}>
157157
required
158158
</Box>
159159
) : null}
160-
</div>
160+
</Box>
161161
);
162162
}
163163

@@ -192,11 +192,15 @@ export const renderProp = ({
192192
{!isEmpty(typeElems) && <div>{typeElems}</div>}
193193
</Flex>
194194

195-
{!isEmpty(prop.description) ? <MutedText fontSize=".875rem">{prop.description}</MutedText> : null}
195+
{!isEmpty(prop.description) ? (
196+
<MutedText pt={1} fontSize=".875rem">
197+
{prop.description}
198+
</MutedText>
199+
) : null}
196200
</Box>
197201

198202
{requiredElem || showInheritedFrom || expanded ? (
199-
<Box maxWidth="30rem" textAlign="right" fontSize=".875rem" pr={3}>
203+
<Box maxWidth="30rem" textAlign="right" fontSize=".75rem" pr={3}>
200204
{requiredElem}
201205

202206
{showInheritedFrom ? <MutedText>{`$ref:${prop.__inheritedFrom.name}`}</MutedText> : null}

0 commit comments

Comments
 (0)