@@ -14,49 +14,39 @@ React Component to help with development of other react components.
1414npm install react-component-viewer --save-dev
1515```
1616
17- # React Component Viewer
17+ # CRA Example
1818
19- ``` typescript
19+ ``` typescript
2020import * as React from ' react' ;
2121
22- import { Registry , ComponentViewer } from ' react-component-viewer' ;
22+ import { Registries , ComponentViewer } from ' react-component-viewer' ;
2323
2424import { buttonsDemo } from ' ./demos/buttons' ;
2525import { linksDemo } from ' ./demos/links' ;
2626import { profileScreenDemo } from ' ./demos/profileScreen' ;
2727import { formsDemo } from ' ./demos/forms' ;
2828import { sideBySideDemo } from ' ./demos/sideBySide' ;
2929
30- const widgets = new Registry ( ' widgets ' );
31- widgets
30+ const registries = new Registries ( );
31+ registries . add ( ' widgets' )
3232 .registerAsGrid (' Links' , 300 , linksDemo )
3333 .registerAsTwoColumnTable (' Forms' , formsDemo )
3434 .registerAsTwoColumnTable (' Buttons' , buttonsDemo )
3535 .registerAsRows (' Inputs' , inputsDemo );
3636
37- const layouts = new Registry (' layouts' );
38- const endToEnd = new Registry (' end to end' );
37+ registries .add (' layouts' )
38+ .registerSingle (' Side by Side' , sideBySideDemo );
39+
40+ registries .add (' end to end' )
41+ .registerSingle (' Single Screen' , profileScreenDemo )
42+ .registerAsMiniApp (' Single Screen mini app' , ' /app' , profileScreenDemo );
3943
4044export class App extends React .Component {
4145 render() {
4246 return (
43- < ComponentViewer
44- registries = {[widgets , layouts , endToEnd ]}
45- dropDown={{
46- label: ' Brand' ,
47- items: [
48- {label: ' Brand-A' , hotKey: ' Alt 1' },
49- {label: ' B-Brand' , hotKey: ' Alt 2' }
50- ],
51- onSelect: this .onBrandSelect
52- }}
53- / >
47+ < ComponentViewer registries = {registries }/ >
5448 );
5549 }
56-
57- private onBrandSelect(brand : string ) {
58- // ...
59- }
6050}
6151```
6252
0 commit comments