11import { Button , Checkbox , Icon } from '@stoplight/ui-kit' ;
22import { action } from '@storybook/addon-actions' ;
3- import { boolean , number , object , select , text , withKnobs } from '@storybook/addon-knobs' ;
3+ import { boolean , number , object , select , withKnobs } from '@storybook/addon-knobs' ;
44import { storiesOf } from '@storybook/react' ;
55import { JSONSchema4 } from 'json-schema' ;
66import * as React from 'react' ;
@@ -17,11 +17,9 @@ storiesOf('JsonSchemaViewer', module)
1717 . addDecorator ( storyFn => < Wrapper > { storyFn ( ) } </ Wrapper > )
1818 . add ( 'default' , ( ) => (
1919 < JsonSchemaViewer
20- name = { text ( 'name' , 'my schema' ) }
2120 schema = { schema as JSONSchema4 }
2221 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 0 ) }
2322 expanded = { boolean ( 'expanded' , true ) }
24- hideTopBar = { boolean ( 'hideTopBar' , false ) }
2523 shouldResolveEagerly = { boolean ( 'shouldResolveEagerly' , false ) }
2624 onGoToRef = { action ( 'onGoToRef' ) }
2725 viewMode = { select (
@@ -37,10 +35,8 @@ storiesOf('JsonSchemaViewer', module)
3735 ) )
3836 . add ( 'custom schema' , ( ) => (
3937 < JsonSchemaViewer
40- name = { text ( 'name' , 'my schema' ) }
4138 schema = { object ( 'schema' , { } ) }
4239 expanded = { boolean ( 'expanded' , true ) }
43- hideTopBar = { boolean ( 'hideTopBar' , false ) }
4440 onGoToRef = { action ( 'onGoToRef' ) }
4541 maxRows = { number ( 'maxRows' , 5 ) }
4642 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
@@ -62,10 +58,8 @@ storiesOf('JsonSchemaViewer', module)
6258
6359 return (
6460 < JsonSchemaViewer
65- name = { text ( 'name' , 'my schema' ) }
6661 schema = { object ( 'schema' , schema as JSONSchema4 ) }
6762 expanded = { boolean ( 'expanded' , true ) }
68- hideTopBar = { boolean ( 'hideTopBar' , false ) }
6963 onGoToRef = { action ( 'onGoToRef' ) }
7064 maxRows = { number ( 'maxRows' , 5 ) }
7165 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
@@ -77,23 +71,19 @@ storiesOf('JsonSchemaViewer', module)
7771 < >
7872 < div style = { { height : 345 } } >
7973 < JsonSchemaViewer
80- name = { text ( 'name' , 'my stress schema' ) }
8174 schema = { stressSchema as JSONSchema4 }
8275 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
8376 expanded = { boolean ( 'expanded' , false ) }
84- hideTopBar = { boolean ( 'hideTopBar' , false ) }
8577 onGoToRef = { action ( 'onGoToRef' ) }
8678 maxRows = { number ( 'maxRows' , 10 ) }
8779 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
8880 />
8981 </ div >
9082 < div style = { { height : 345 } } >
9183 < JsonSchemaViewer
92- name = { text ( 'name' , 'my stress schema 2' ) }
9384 schema = { stressSchema as JSONSchema4 }
9485 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
9586 expanded = { boolean ( 'expanded' , false ) }
96- hideTopBar = { boolean ( 'hideTopBar' , false ) }
9787 onGoToRef = { action ( 'onGoToRef' ) }
9888 maxRows = { number ( 'maxRows' , 10 ) }
9989 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
@@ -106,14 +96,12 @@ storiesOf('JsonSchemaViewer', module)
10696 schema = { allOfSchemaResolved as JSONSchema4 }
10797 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
10898 expanded = { boolean ( 'expanded' , false ) }
109- hideTopBar = { boolean ( 'hideTopBar' , false ) }
11099 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
111100 onGoToRef = { action ( 'onGoToRef' ) }
112101 />
113102 ) )
114103 . add ( 'error boundary' , ( ) => (
115104 < JsonSchemaViewer
116- name = { text ( 'name' , 'throw me an error!' ) }
117105 // @ts -ignore
118106 schema = { select (
119107 'schema' ,
@@ -125,7 +113,6 @@ storiesOf('JsonSchemaViewer', module)
125113 ) }
126114 expanded = { boolean ( 'expanded' , false ) }
127115 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
128- hideTopBar = { boolean ( 'hideTopBar' , false ) }
129116 onGoToRef = { action ( 'onGoToRef' ) }
130117 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
131118 />
@@ -159,19 +146,16 @@ storiesOf('JsonSchemaViewer', module)
159146 } }
160147 expanded = { boolean ( 'expanded' , false ) }
161148 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
162- hideTopBar = { boolean ( 'hideTopBar' , false ) }
163149 onGoToRef = { action ( 'onGoToRef' ) }
164150 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
165151 />
166152 ) )
167153 . add ( 'dark' , ( ) => (
168154 < div style = { { height : '100vh' } } className = "bp3-dark bg-gray-8" >
169155 < JsonSchemaViewer
170- name = { text ( 'name' , 'my stress schema' ) }
171156 schema = { schema as JSONSchema4 }
172157 defaultExpandedDepth = { number ( 'defaultExpandedDepth' , 2 ) }
173158 expanded = { boolean ( 'expanded' , false ) }
174- hideTopBar = { boolean ( 'hideTopBar' , false ) }
175159 onGoToRef = { action ( 'onGoToRef' ) }
176160 mergeAllOf = { boolean ( 'mergeAllOf' , true ) }
177161 />
0 commit comments