Skip to content

Commit 297cda7

Browse files
committed
Rewrite interactive documentation
Consolidate all docs within the latest storybook Ref #1172
1 parent 8cf00a5 commit 297cda7

File tree

463 files changed

+11029
-36212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

463 files changed

+11029
-36212
lines changed

.eslintrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"react": {
44
"pragma": "React",
55
"version": "16.6",
6-
"flowVersion": "0.78" // Flow version
6+
"flowVersion": "0.109.0" // Flow version
77
}
88
},
99
// babel parser to support ES6/7 features
@@ -139,7 +139,7 @@
139139

140140
// react
141141
"react/display-name": 0,
142-
"react/jsx-no-bind": 2,
142+
"react/jsx-no-bind": 0,
143143
"react/jsx-no-duplicate-props": 2,
144144
"react/jsx-no-undef": 2,
145145
"react/jsx-pascal-case": 2,
@@ -153,7 +153,7 @@
153153
"react/no-string-refs": 2,
154154
"react/no-unknown-property": 2,
155155
"react/prefer-es6-class": 2,
156-
"react/prop-types": 2,
156+
"react/prop-types": 0,
157157
"react/react-in-jsx-scope": 0,
158158
"react/self-closing-comp": 2,
159159
"react/sort-comp": 0,

.github/CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ yarn compile
7070
yarn compile --watch
7171
```
7272

73-
## Website and visual tests
73+
## Documentation and visual tests
7474

7575
To run the interactive storybook:
7676

7777
```
78-
yarn website
78+
yarn docs
7979
```
8080

81-
When you're also making changes to the 'react-native-web' source files, run this command in another process:
81+
When you're also making changes to the 'react-native-web' source files, run this
82+
command in another process:
8283

8384
```
8485
yarn compile --watch

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
{
22
"private": true,
33
"version": "0.11.7",
4-
"name": "react-native-web-monorepo",
4+
"name": "monorepo",
55
"scripts": {
66
"clean": "del-cli ./packages/*/dist",
77
"compile": "npm-run-all clean -p \"compile:* -- {@}\" --",
88
"compile:commonjs": "cd packages/react-native-web && cross-env BABEL_ENV=commonjs babel --root-mode upward src --out-dir dist/cjs --ignore \"**/__tests__\"",
99
"compile:es": "cd packages/react-native-web && babel --root-mode upward src --out-dir dist --ignore \"**/__tests__\"",
1010
"benchmarks": "cd packages/benchmarks && yarn build",
1111
"benchmarks:release": "cd packages/benchmarks && yarn release",
12-
"examples": "cd packages/examples && yarn build",
13-
"examples:release": "cd packages/examples && yarn release",
14-
"website": "cd packages/website && yarn start",
15-
"website:release": "cd packages/website && yarn release",
12+
"docs": "cd packages/docs && yarn start",
13+
"docs:release": "cd packages/docs && yarn release",
1614
"flow": "flow",
1715
"fmt": "prettier --write \"**/*.js\"",
1816
"jest": "jest --config ./scripts/jest/config.js",
@@ -21,7 +19,7 @@
2119
"precommit": "lint-staged",
2220
"prerelease": "yarn test && yarn compile && yarn compile:commonjs",
2321
"release": "node ./scripts/release/publish.js",
24-
"postrelease": "yarn benchmarks:release && yarn examples:release && yarn website:release",
22+
"postrelease": "yarn benchmarks:release && yarn docs:release",
2523
"test": "yarn flow && yarn lint:check && yarn jest --runInBand"
2624
},
2725
"devDependencies": {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
4+
module.exports = async ({ config, mode }) => {
5+
config.module.rules.push({
6+
test: /\.(gif|jpe?g|png|svg)$/,
7+
use: {
8+
loader: 'url-loader',
9+
options: { name: '[name].[ext]' }
10+
}
11+
});
12+
13+
config.resolve.extensions = ['.web.js', '.js', '.json', '.web.jsx', '.jsx'];
14+
15+
config.resolve.alias = {
16+
'react-native': 'react-native-web'
17+
};
18+
19+
return config;
20+
};

packages/docs/.storybook/addons.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// import '@storybook/addon-options/register';

packages/docs/.storybook/config.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { create } from '@storybook/theming';
2+
3+
// import centered from './decorator-centered';
4+
import { addParameters, configure, addDecorator } from '@storybook/react';
5+
6+
// Option defaults:
7+
addParameters({
8+
options: {
9+
storySort: (a, b) => {
10+
const sectionA = a[1].id.split('-')[0];
11+
const sectionB = b[1].id.split('-')[0];
12+
13+
return sectionB.localeCompare(sectionA);
14+
},
15+
theme: create({
16+
base: 'light',
17+
brandTitle: 'React Native for Web',
18+
brandUrl: 'https://necolas.github.io/react-native-web'
19+
// To control appearance:
20+
// brandImage: 'http://url.of/some.svg',
21+
}),
22+
/**
23+
* regex for finding the hierarchy separator
24+
* @example:
25+
* null - turn off hierarchy
26+
* /\// - split by `/`
27+
* /\./ - split by `.`
28+
* /\/|\./ - split by `/` or `.`
29+
* @type {Regex}
30+
*/
31+
hierarchySeparator: /\/|\./,
32+
/**
33+
* regex for finding the hierarchy root separator
34+
* @example:
35+
* null - turn off multiple hierarchy roots
36+
* /\|/ - split by `|`
37+
* @type {Regex}
38+
*/
39+
hierarchyRootSeparator: /\|/,
40+
panelPosition: 'bottom'
41+
}
42+
});
43+
44+
// addDecorator(centered);
45+
46+
const context = require.context('../src', true, /\.stories\.(js|mdx)$/);
47+
48+
configure(context, module);

packages/website/storybook/.storybook/decorator-centered.js renamed to packages/docs/.storybook/decorator-centered.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { StyleSheet, View } from 'react-native';
33

44
const styles = StyleSheet.create({
55
root: {
6-
minHeight: '100vh',
7-
maxWidth: 680,
8-
marginHorizontal: 'auto'
6+
maxWidth: '100%'
97
}
108
});
119

packages/docs/.storybook/presets.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = [
2+
{
3+
name: '@storybook/addon-docs/preset',
4+
options: {
5+
configureJSX: true,
6+
babelOptions: {},
7+
sourceLoaderOptions: null
8+
}
9+
}
10+
];

packages/docs/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"private": true,
3+
"name": "docs",
4+
"version": "0.11.7",
5+
"scripts": {
6+
"build": "build-storybook --docs -o ./dist -c ./.storybook",
7+
"start": "start-storybook --docs -p 9001 -c ./.storybook",
8+
"release": "yarn build && git checkout gh-pages && rm -rf ../../docs && mv dist ../../docs && git add -A && git commit -m \"Deploy documentation\" && git push origin gh-pages && git checkout -"
9+
},
10+
"dependencies": {
11+
"@storybook/addon-docs": "5.3.0-alpha.43",
12+
"@storybook/addon-options": "5.3.0-alpha.43",
13+
"@storybook/cli": "5.3.0-alpha.43",
14+
"@storybook/react": "5.3.0-alpha.43",
15+
"@storybook/theming": "5.3.0-alpha.43",
16+
"react-native-web": "0.11.7"
17+
},
18+
"devDependencies": {
19+
"babel-plugin-react-native-web": "0.11.7",
20+
"url-loader": "^2.2.0",
21+
"webpack": "^4.41.2"
22+
}
23+
}

0 commit comments

Comments
 (0)