Skip to content

Commit d7cdda7

Browse files
committed
chore: add example to story
1 parent 1cabcad commit d7cdda7

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.storybook/preview-head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">

src/__stories__/JsonSchemaViewer.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
import * as React from 'react';
22

3-
import { boolean, number, text } from '@storybook/addon-knobs';
3+
import { boolean, number, object, text } from '@storybook/addon-knobs';
44
import { storiesOf } from '@storybook/react';
55

66
import { JsonSchemaViewer } from '../JsonSchemaViewer';
77

8+
const schema = {
9+
properties: {
10+
data: {
11+
items: {
12+
$ref: '#/definitions/Gif',
13+
},
14+
type: 'array',
15+
},
16+
meta: {
17+
$ref: '#/definitions/Meta',
18+
},
19+
pagination: {
20+
$ref: '#/definitions/Pagination',
21+
},
22+
},
23+
};
24+
825
storiesOf('JsonSchemaViewer', module).add('with text', () => (
926
<JsonSchemaViewer
1027
name={text('name', 'name')}
1128
schemas={{}}
12-
schema={{}}
29+
schema={object('schema', schema)}
1330
limitPropertyCount={number('limitPropertyCount', 20)}
1431
hideRoot={boolean('hideRoot', false)}
1532
expanded={boolean('expanded', true)}

0 commit comments

Comments
 (0)