Skip to content

Commit 049e538

Browse files
committed
[changed] Update for React v0.14
1 parent b8448f5 commit 049e538

File tree

181 files changed

+814
-693
lines changed

Some content is hidden

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

181 files changed

+814
-693
lines changed

docs/build.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
/* eslint no-console: 0 */
22

3-
import React from 'react';
3+
import fsp from 'fs-promise';
44
import path from 'path';
5+
import React from 'react';
6+
import ReactDOMServer from 'react-dom/server';
57
import Router from 'react-router';
6-
import routes from './src/Routes';
8+
import Location from 'react-router/lib/Location';
9+
710
import Root from './src/Root';
8-
import fsp from 'fs-promise';
9-
import { copy } from '../tools/fs-utils';
10-
import { exec } from '../tools/exec';
11+
import routes from './src/Routes';
12+
1113
import metadata from './generate-metadata';
1214

15+
import {copy} from '../tools/fs-utils';
16+
import {exec} from '../tools/exec';
17+
1318
const repoRoot = path.resolve(__dirname, '../');
1419
const docsBuilt = path.join(repoRoot, 'docs-built');
1520

@@ -24,12 +29,14 @@ const readmeDest = path.join(docsBuilt, 'README.md');
2429
* @return {Promise} promise
2530
* @internal
2631
*/
27-
function generateHTML(fileName, propData) {
28-
return new Promise((resolve, reject) => {
32+
function generateHTML(fileName) {
33+
return new Promise((resolve) => {
2934
const urlSlug = fileName === 'index.html' ? '/' : `/${fileName}`;
3035

31-
Router.run(routes, urlSlug, Handler => {
32-
let html = React.renderToString(React.createElement(Handler, { propData }));
36+
Router.run(routes, new Location(urlSlug), (error, initialState) => {
37+
let html = ReactDOMServer.renderToString(
38+
<Router {...initialState} />
39+
);
3340
html = '<!doctype html>' + html;
3441
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);
3542
resolve(write);
@@ -46,8 +53,10 @@ export default function BuildDocs({dev}) {
4653
.then(() => fsp.mkdir(docsBuilt))
4754
.then(metadata)
4855
.then(propData => {
56+
Root.assetBaseUrl = '';
57+
Root.propData = propData;
4958

50-
let pagesGenerators = Root.getPages().map( page => generateHTML(page, propData));
59+
const pagesGenerators = Root.getPages().map(generateHTML);
5160

5261
return Promise.all(pagesGenerators.concat([
5362
exec(`webpack --config webpack.docs.js --bail ${devOption}`),

docs/client.js

+24-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1+
import CodeMirror from 'codemirror';
2+
import 'codemirror/addon/runmode/runmode';
3+
import 'codemirror/mode/htmlmixed/htmlmixed';
4+
import 'codemirror/mode/javascript/javascript';
5+
import React from 'react';
6+
import ReactDOM from 'react-dom';
7+
import {Router} from 'react-router';
8+
import {history} from 'react-router/lib/BrowserHistory';
9+
10+
import Root from './src/Root';
11+
import routes from './src/Routes';
12+
113
import 'bootstrap/less/bootstrap.less';
14+
215
import './assets/docs.css';
316
import './assets/style.css';
417

18+
import 'codemirror/lib/codemirror.css';
19+
import 'codemirror/theme/solarized.css';
20+
import './assets/CodeMirror.css';
21+
522
import './assets/carousel.png';
623
import './assets/logo.png';
724
import './assets/favicon.ico';
825
import './assets/thumbnail.png';
926
import './assets/thumbnaildiv.png';
1027

11-
import 'codemirror/mode/htmlmixed/htmlmixed';
12-
import 'codemirror/mode/javascript/javascript';
13-
import 'codemirror/theme/solarized.css';
14-
import 'codemirror/lib/codemirror.css';
15-
import './assets/CodeMirror.css';
16-
17-
import React from 'react';
18-
import CodeMirror from 'codemirror';
19-
import 'codemirror/addon/runmode/runmode';
20-
import Router from 'react-router';
21-
import routes from './src/Routes';
22-
2328
global.CodeMirror = CodeMirror;
2429

25-
Router.run(routes, Router.RefreshLocation, Handler => {
26-
React.render(
27-
React.createElement(Handler, window.INITIAL_PROPS), document);
28-
});
30+
Root.assetBaseUrl = window.ASSET_BASE_URL;
31+
Root.propData = window.PROP_DATA;
32+
33+
ReactDOM.render(
34+
<Router history={history} children={routes} />,
35+
document
36+
);

docs/examples/.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"globals": {
77
"mountNode",
88
"React",
9+
"ReactDOM",
910
"classNames",
1011
"Accordion",
1112
"Alert",

docs/examples/AlertAutoDismissable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ const AlertAutoDismissable = React.createClass({
2929
}
3030
});
3131

32-
React.render(<AlertAutoDismissable />, mountNode);
32+
ReactDOM.render(<AlertAutoDismissable />, mountNode);

docs/examples/AlertBasic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ const alertInstance = (
44
</Alert>
55
);
66

7-
React.render(alertInstance, mountNode);
7+
ReactDOM.render(alertInstance, mountNode);

docs/examples/AlertDismissable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ const AlertDismissable = React.createClass({
3434
}
3535
});
3636

37-
React.render(<AlertDismissable />, mountNode);
37+
ReactDOM.render(<AlertDismissable />, mountNode);

docs/examples/Badge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ const badgeInstance = (
22
<p>Badges <Badge>42</Badge></p>
33
);
44

5-
React.render(badgeInstance, mountNode);
5+
ReactDOM.render(badgeInstance, mountNode);

docs/examples/ButtonActive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const buttonsInstance = (
55
</ButtonToolbar>
66
);
77

8-
React.render(buttonsInstance, mountNode);
8+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/ButtonBlock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ const buttonsInstance = (
77
</div>
88
);
99

10-
React.render(buttonsInstance, mountNode);
10+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/ButtonDisabled.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const buttonsInstance = (
55
</ButtonToolbar>
66
);
77

8-
React.render(buttonsInstance, mountNode);
8+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/ButtonGroupBasic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const buttonGroupInstance = (
66
</ButtonGroup>
77
);
88

9-
React.render(buttonGroupInstance, mountNode);
9+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonGroupBlock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const buttonGroupInstance = (
55
</ButtonGroup>
66
);
77

8-
React.render(buttonGroupInstance, mountNode);
8+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonGroupJustified.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const buttonGroupInstance = (
99
</ButtonGroup>
1010
);
1111

12-
React.render(buttonGroupInstance, mountNode);
12+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonGroupNested.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const buttonGroupInstance = (
99
</ButtonGroup>
1010
);
1111

12-
React.render(buttonGroupInstance, mountNode);
12+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonGroupSizes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ const buttonGroupInstance = (
3434
</div>
3535
);
3636

37-
React.render(buttonGroupInstance, mountNode);
37+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonGroupVertical.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ const buttonGroupInstance = (
1919
</ButtonGroup>
2020
);
2121

22-
React.render(buttonGroupInstance, mountNode);
22+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonInput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ const ButtonInputExample = React.createClass({
4141
}
4242
});
4343

44-
React.render(<ButtonInputExample />, mountNode);
44+
ReactDOM.render(<ButtonInputExample />, mountNode);

docs/examples/ButtonLoading.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ const LoadingButton = React.createClass({
2929
}
3030
});
3131

32-
React.render(<LoadingButton />, mountNode);
32+
ReactDOM.render(<LoadingButton />, mountNode);

docs/examples/ButtonSizes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ const buttonsInstance = (
1919
</div>
2020
);
2121

22-
React.render(buttonsInstance, mountNode);
22+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/ButtonTagTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const buttonsInstance = (
55
</ButtonToolbar>
66
);
77

8-
React.render(buttonsInstance, mountNode);
8+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/ButtonToolbarBasic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ const buttonGroupInstance = (
1919
</ButtonToolbar>
2020
);
2121

22-
React.render(buttonGroupInstance, mountNode);
22+
ReactDOM.render(buttonGroupInstance, mountNode);

docs/examples/ButtonTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ const buttonsInstance = (
2323
</ButtonToolbar>
2424
);
2525

26-
React.render(buttonsInstance, mountNode);
26+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/CarouselControlled.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ const ControlledCarousel = React.createClass({
4343
}
4444
});
4545

46-
React.render(<ControlledCarousel />, mountNode);
46+
ReactDOM.render(<ControlledCarousel />, mountNode);

docs/examples/CarouselUncontrolled.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ const carouselInstance = (
2424
</Carousel>
2525
);
2626

27-
React.render(carouselInstance, mountNode);
27+
ReactDOM.render(carouselInstance, mountNode);

docs/examples/Collapse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ class Example extends React.Component {
2525
}
2626
}
2727

28-
React.render(<Example/>, mountNode);
28+
ReactDOM.render(<Example/>, mountNode);

docs/examples/CollapsibleNav.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ const navbarInstance = (
2020
</Navbar>
2121
);
2222

23-
React.render(navbarInstance, mountNode);
23+
ReactDOM.render(navbarInstance, mountNode);

docs/examples/DropdownButtonBasic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ const buttonsInstance = (
1616
<ButtonToolbar>{BUTTONS.map(renderDropdownButton)}</ButtonToolbar>
1717
);
1818

19-
React.render(buttonsInstance, mountNode);
19+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/DropdownButtonNoCaret.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const buttonInstance = (
1010
</ButtonToolbar>
1111
);
1212

13-
React.render(buttonInstance, mountNode);
13+
ReactDOM.render(buttonInstance, mountNode);

docs/examples/DropdownButtonSizes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ const buttonsInstance = (
3232
</div>
3333
);
3434

35-
React.render(buttonsInstance, mountNode);
35+
ReactDOM.render(buttonsInstance, mountNode);

docs/examples/Fade.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ class Example extends React.Component {
2626
}
2727
}
2828

29-
React.render(<Example/>, mountNode);
29+
ReactDOM.render(<Example/>, mountNode);

docs/examples/Glyphicon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ const glyphInstance = (
1919
</div>
2020
);
2121

22-
React.render(glyphInstance, mountNode);
22+
ReactDOM.render(glyphInstance, mountNode);

docs/examples/GridBasic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ const navInstance = (
2222
</Grid>
2323
);
2424

25-
React.render(navInstance, mountNode);
25+
ReactDOM.render(navInstance, mountNode);

docs/examples/Input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ const ExampleInput = React.createClass({
3838
}
3939
});
4040

41-
React.render(<ExampleInput />, mountNode);
41+
ReactDOM.render(<ExampleInput />, mountNode);

docs/examples/InputAddons.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ const inputAddonsInstance = (
2121
</form>
2222
);
2323

24-
React.render(inputAddonsInstance, mountNode);
24+
ReactDOM.render(inputAddonsInstance, mountNode);

docs/examples/InputHorizontal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const inputHorizontalInstance = (
66
</form>
77
);
88

9-
React.render(inputHorizontalInstance, mountNode);
9+
ReactDOM.render(inputHorizontalInstance, mountNode);

docs/examples/InputSizes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const inputSizeInstance = (
66
</form>
77
);
88

9-
React.render(inputSizeInstance, mountNode);
9+
ReactDOM.render(inputSizeInstance, mountNode);

docs/examples/InputTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ const inputTypeInstance = (
2121
</form>
2222
);
2323

24-
React.render(inputTypeInstance, mountNode);
24+
ReactDOM.render(inputTypeInstance, mountNode);

docs/examples/InputValidation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const inputValidationInstance = (
66
</form>
77
);
88

9-
React.render(inputValidationInstance, mountNode);
9+
ReactDOM.render(inputValidationInstance, mountNode);

docs/examples/InputWrapper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ const inputWrapperInstance = (
1111
</Input>
1212
);
1313

14-
React.render(inputWrapperInstance, mountNode);
14+
ReactDOM.render(inputWrapperInstance, mountNode);

docs/examples/Jumbotron.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const jumbotronInstance = (
66
</Jumbotron>
77
);
88

9-
React.render(jumbotronInstance, mountNode);
9+
ReactDOM.render(jumbotronInstance, mountNode);

docs/examples/Label.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const labelInstance = (
99
</div>
1010
);
1111

12-
React.render(labelInstance, mountNode);
12+
ReactDOM.render(labelInstance, mountNode);

docs/examples/LabelVariations.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const labelVariationInstance = (
99
</div>
1010
);
1111

12-
React.render(labelVariationInstance, mountNode);
12+
ReactDOM.render(labelVariationInstance, mountNode);

docs/examples/ListGroupActive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const listgroupInstance = (
66
</ListGroup>
77
);
88

9-
React.render(listgroupInstance, mountNode);
9+
ReactDOM.render(listgroupInstance, mountNode);

docs/examples/ListGroupDefault.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const listgroupInstance = (
66
</ListGroup>
77
);
88

9-
React.render(listgroupInstance, mountNode);
9+
ReactDOM.render(listgroupInstance, mountNode);

docs/examples/ListGroupHeader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const listgroupInstance = (
66
</ListGroup>
77
);
88

9-
React.render(listgroupInstance, mountNode);
9+
ReactDOM.render(listgroupInstance, mountNode);

docs/examples/ListGroupLinked.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ const listgroupInstance = (
66
</ListGroup>
77
);
88

9-
React.render(listgroupInstance, mountNode);
9+
ReactDOM.render(listgroupInstance, mountNode);

docs/examples/ListGroupStyle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ const listgroupInstance = (
77
</ListGroup>
88
);
99

10-
React.render(listgroupInstance, mountNode);
10+
ReactDOM.render(listgroupInstance, mountNode);

docs/examples/MenuItem.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ const MenuItems = (
2323
</div>
2424
);
2525

26-
React.render(MenuItems, mountNode);
26+
ReactDOM.render(MenuItems, mountNode);

docs/examples/Modal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ const Example = React.createClass({
6464
}
6565
});
6666

67-
React.render(<Example/>, mountNode);
67+
ReactDOM.render(<Example/>, mountNode);

docs/examples/ModalContained.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ const Trigger = React.createClass({
4848
}
4949
});
5050

51-
React.render(<Trigger />, mountNode);
51+
ReactDOM.render(<Trigger />, mountNode);

0 commit comments

Comments
 (0)