Skip to content

Commit adecc1f

Browse files
Docs (#31)
1 parent 50a195e commit adecc1f

10 files changed

Lines changed: 282 additions & 74 deletions

File tree

README.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,39 @@ React Component to help with development of other react components.
1414
npm install react-component-viewer --save-dev
1515
```
1616

17-
# React Component Viewer
17+
# CRA Example
1818

19-
```typescript
19+
``` typescript
2020
import * as React from 'react';
2121

22-
import { Registry, ComponentViewer } from 'react-component-viewer';
22+
import { Registries, ComponentViewer } from 'react-component-viewer';
2323

2424
import { buttonsDemo } from './demos/buttons';
2525
import { linksDemo } from './demos/links';
2626
import { profileScreenDemo } from './demos/profileScreen';
2727
import { formsDemo } from './demos/forms';
2828
import { 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

4044
export 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

documentation/rcv/package-lock.json

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

documentation/rcv/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@
99
"start": "npm run develop",
1010
"build": "gatsby build",
1111
"serve": "gatsby serve",
12-
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
12+
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\"",
13+
"deploy": "gatsby build --prefix-paths && gh-pages -d public"
1314
},
1415
"dependencies": {
1516
"gatsby": "^2.0.76",
17+
"gatsby-plugin-react-helmet": "^3.0.6",
1618
"marked": "^0.6.0",
1719
"prismjs": "^1.15.0",
1820
"react": "^16.5.1",
19-
"react-dom": "^16.5.1"
21+
"react-dom": "^16.5.1",
22+
"react-helmet": "^5.2.0"
2023
},
2124
"repository": {
2225
"type": "git",
2326
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
2427
},
2528
"bugs": {
2629
"url": "https://github.com/gatsbyjs/gatsby/issues"
30+
},
31+
"devDependencies": {
32+
"gh-pages": "^2.0.1"
2733
}
2834
}

documentation/rcv/src/components/Image.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import {Zoomable} from "./Zoomable";
77
import './Image.css'
88

99
export function Image({path, description}) {
10+
const fullPath = withPrefix(path);
1011
return (
1112
<Zoomable>
1213
<div className="image">
13-
<img src={withPrefix(path)} alt={description}/>
14+
<img src={fullPath} srcSet={fullPath + " 2x"} alt={description}/>
1415
</div>
1516
</Zoomable>
1617
)

0 commit comments

Comments
 (0)