1+ # Intro
2+
3+ ![ screen example] ( documentation/rcv/static/screen-example.png )
4+
5+ React Component to help with development of other react components.
6+ * Just a component, no build system: works with your setup seamlessly.
7+ * See your components at once in the different states.
8+ * Zoom-in into a single component for debug.
9+ * User defined theme switching for multi brand/theme development.
10+
111# Installation
212
313```
@@ -6,9 +16,6 @@ npm install react-component-viewer --save-dev
616
717# React Component Viewer
818
9- Is a React component to preview and develop your components.
10- Use it in your CRA created app as a demo app.
11-
1219``` typescript
1320import * as React from ' react' ;
1421
@@ -25,35 +32,45 @@ widgets
2532 .registerAsGrid (' Links' , 300 , linksDemo )
2633 .registerAsTwoColumnTable (' Forms' , formsDemo )
2734 .registerAsTwoColumnTable (' Buttons' , buttonsDemo )
28- .registerSingle (' Single Screen' , profileScreenDemo )
29- .registerAsMiniApp (' Single Screen mini app' , ' /app' , profileScreenDemo );
35+ .registerAsRows (' Inputs' , inputsDemo );
3036
3137const layouts = new Registry (' layouts' );
32- layouts
33- .registerSingle (' Side by Side' , sideBySideDemo );
34-
35- export function App() {
36- return (
37- < ComponentViewer registries = {[widgets , layouts ]}/>
38- );
38+ const endToEnd = new Registry (' end to end' );
39+
40+ export class App extends React .Component {
41+ render() {
42+ 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+ / >
54+ );
55+ }
56+
57+ private onBrandSelect(brand : string ) {
58+ // ...
59+ }
3960}
4061```
4162
42- It will work with your build system, the language of your choice and style processing.
43-
44- 
45-
4663# Demo functions
4764
4865Demo must be defined in a function that accepts ` Registry ` . Function should register components to display.
4966
5067``` typescript
5168export function buttonsDemo(registry : Registry ) {
5269 registry
53- .add (' enabled ' , () => <Button label =" click me" onClick ={onClick}/>,
70+ .add (' primary ' , () => <Button primary label =" click me" onClick ={onClick}/>,
5471 ` long description
5572 multiline markdown ` )
56- .add (' disabled ' , () => <Button label =" click me" enabled ={false} onClick ={onClick}/>)
73+ .add (' secondary ' , () => <Button label =" click me" onClick ={onClick}/>);
5774}
5875```
5976
0 commit comments