Skip to content

Commit

Permalink
[changed] Update for React v0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Aug 13, 2015
1 parent b8448f5 commit 049e538
Show file tree
Hide file tree
Showing 181 changed files with 814 additions and 693 deletions.
29 changes: 19 additions & 10 deletions docs/build.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/* eslint no-console: 0 */

import React from 'react';
import fsp from 'fs-promise';
import path from 'path';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import Router from 'react-router';
import routes from './src/Routes';
import Location from 'react-router/lib/Location';

import Root from './src/Root';
import fsp from 'fs-promise';
import { copy } from '../tools/fs-utils';
import { exec } from '../tools/exec';
import routes from './src/Routes';

import metadata from './generate-metadata';

import {copy} from '../tools/fs-utils';
import {exec} from '../tools/exec';

const repoRoot = path.resolve(__dirname, '../');
const docsBuilt = path.join(repoRoot, 'docs-built');

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

Router.run(routes, urlSlug, Handler => {
let html = React.renderToString(React.createElement(Handler, { propData }));
Router.run(routes, new Location(urlSlug), (error, initialState) => {
let html = ReactDOMServer.renderToString(
<Router {...initialState} />
);
html = '<!doctype html>' + html;
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);
resolve(write);
Expand All @@ -46,8 +53,10 @@ export default function BuildDocs({dev}) {
.then(() => fsp.mkdir(docsBuilt))
.then(metadata)
.then(propData => {
Root.assetBaseUrl = '';
Root.propData = propData;

let pagesGenerators = Root.getPages().map( page => generateHTML(page, propData));
const pagesGenerators = Root.getPages().map(generateHTML);

return Promise.all(pagesGenerators.concat([
exec(`webpack --config webpack.docs.js --bail ${devOption}`),
Expand Down
40 changes: 24 additions & 16 deletions docs/client.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import CodeMirror from 'codemirror';
import 'codemirror/addon/runmode/runmode';
import 'codemirror/mode/htmlmixed/htmlmixed';
import 'codemirror/mode/javascript/javascript';
import React from 'react';
import ReactDOM from 'react-dom';
import {Router} from 'react-router';
import {history} from 'react-router/lib/BrowserHistory';

import Root from './src/Root';
import routes from './src/Routes';

import 'bootstrap/less/bootstrap.less';

import './assets/docs.css';
import './assets/style.css';

import 'codemirror/lib/codemirror.css';
import 'codemirror/theme/solarized.css';
import './assets/CodeMirror.css';

import './assets/carousel.png';
import './assets/logo.png';
import './assets/favicon.ico';
import './assets/thumbnail.png';
import './assets/thumbnaildiv.png';

import 'codemirror/mode/htmlmixed/htmlmixed';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/theme/solarized.css';
import 'codemirror/lib/codemirror.css';
import './assets/CodeMirror.css';

import React from 'react';
import CodeMirror from 'codemirror';
import 'codemirror/addon/runmode/runmode';
import Router from 'react-router';
import routes from './src/Routes';

global.CodeMirror = CodeMirror;

Router.run(routes, Router.RefreshLocation, Handler => {
React.render(
React.createElement(Handler, window.INITIAL_PROPS), document);
});
Root.assetBaseUrl = window.ASSET_BASE_URL;
Root.propData = window.PROP_DATA;

ReactDOM.render(
<Router history={history} children={routes} />,
document
);
1 change: 1 addition & 0 deletions docs/examples/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"globals": {
"mountNode",
"React",
"ReactDOM",
"classNames",
"Accordion",
"Alert",
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/AlertAutoDismissable.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ const AlertAutoDismissable = React.createClass({
}
});

React.render(<AlertAutoDismissable />, mountNode);
ReactDOM.render(<AlertAutoDismissable />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/AlertBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ const alertInstance = (
</Alert>
);

React.render(alertInstance, mountNode);
ReactDOM.render(alertInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/AlertDismissable.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ const AlertDismissable = React.createClass({
}
});

React.render(<AlertDismissable />, mountNode);
ReactDOM.render(<AlertDismissable />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ const badgeInstance = (
<p>Badges <Badge>42</Badge></p>
);

React.render(badgeInstance, mountNode);
ReactDOM.render(badgeInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonActive.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const buttonsInstance = (
</ButtonToolbar>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const buttonsInstance = (
</div>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonDisabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const buttonsInstance = (
</ButtonToolbar>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const buttonGroupInstance = (
</ButtonGroup>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const buttonGroupInstance = (
</ButtonGroup>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupJustified.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const buttonGroupInstance = (
</ButtonGroup>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupNested.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const buttonGroupInstance = (
</ButtonGroup>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupSizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ const buttonGroupInstance = (
</div>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonGroupVertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const buttonGroupInstance = (
</ButtonGroup>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ const ButtonInputExample = React.createClass({
}
});

React.render(<ButtonInputExample />, mountNode);
ReactDOM.render(<ButtonInputExample />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ const LoadingButton = React.createClass({
}
});

React.render(<LoadingButton />, mountNode);
ReactDOM.render(<LoadingButton />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonSizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const buttonsInstance = (
</div>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonTagTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const buttonsInstance = (
</ButtonToolbar>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonToolbarBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const buttonGroupInstance = (
</ButtonToolbar>
);

React.render(buttonGroupInstance, mountNode);
ReactDOM.render(buttonGroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ButtonTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const buttonsInstance = (
</ButtonToolbar>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/CarouselControlled.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ const ControlledCarousel = React.createClass({
}
});

React.render(<ControlledCarousel />, mountNode);
ReactDOM.render(<ControlledCarousel />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/CarouselUncontrolled.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ const carouselInstance = (
</Carousel>
);

React.render(carouselInstance, mountNode);
ReactDOM.render(carouselInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class Example extends React.Component {
}
}

React.render(<Example/>, mountNode);
ReactDOM.render(<Example/>, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/CollapsibleNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ const navbarInstance = (
</Navbar>
);

React.render(navbarInstance, mountNode);
ReactDOM.render(navbarInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/DropdownButtonBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ const buttonsInstance = (
<ButtonToolbar>{BUTTONS.map(renderDropdownButton)}</ButtonToolbar>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/DropdownButtonNoCaret.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const buttonInstance = (
</ButtonToolbar>
);

React.render(buttonInstance, mountNode);
ReactDOM.render(buttonInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/DropdownButtonSizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ const buttonsInstance = (
</div>
);

React.render(buttonsInstance, mountNode);
ReactDOM.render(buttonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Fade.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ class Example extends React.Component {
}
}

React.render(<Example/>, mountNode);
ReactDOM.render(<Example/>, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Glyphicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const glyphInstance = (
</div>
);

React.render(glyphInstance, mountNode);
ReactDOM.render(glyphInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/GridBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const navInstance = (
</Grid>
);

React.render(navInstance, mountNode);
ReactDOM.render(navInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ const ExampleInput = React.createClass({
}
});

React.render(<ExampleInput />, mountNode);
ReactDOM.render(<ExampleInput />, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputAddons.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ const inputAddonsInstance = (
</form>
);

React.render(inputAddonsInstance, mountNode);
ReactDOM.render(inputAddonsInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputHorizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const inputHorizontalInstance = (
</form>
);

React.render(inputHorizontalInstance, mountNode);
ReactDOM.render(inputHorizontalInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputSizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const inputSizeInstance = (
</form>
);

React.render(inputSizeInstance, mountNode);
ReactDOM.render(inputSizeInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ const inputTypeInstance = (
</form>
);

React.render(inputTypeInstance, mountNode);
ReactDOM.render(inputTypeInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const inputValidationInstance = (
</form>
);

React.render(inputValidationInstance, mountNode);
ReactDOM.render(inputValidationInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/InputWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ const inputWrapperInstance = (
</Input>
);

React.render(inputWrapperInstance, mountNode);
ReactDOM.render(inputWrapperInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Jumbotron.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const jumbotronInstance = (
</Jumbotron>
);

React.render(jumbotronInstance, mountNode);
ReactDOM.render(jumbotronInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const labelInstance = (
</div>
);

React.render(labelInstance, mountNode);
ReactDOM.render(labelInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/LabelVariations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const labelVariationInstance = (
</div>
);

React.render(labelVariationInstance, mountNode);
ReactDOM.render(labelVariationInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ListGroupActive.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const listgroupInstance = (
</ListGroup>
);

React.render(listgroupInstance, mountNode);
ReactDOM.render(listgroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ListGroupDefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const listgroupInstance = (
</ListGroup>
);

React.render(listgroupInstance, mountNode);
ReactDOM.render(listgroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ListGroupHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const listgroupInstance = (
</ListGroup>
);

React.render(listgroupInstance, mountNode);
ReactDOM.render(listgroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ListGroupLinked.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const listgroupInstance = (
</ListGroup>
);

React.render(listgroupInstance, mountNode);
ReactDOM.render(listgroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ListGroupStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const listgroupInstance = (
</ListGroup>
);

React.render(listgroupInstance, mountNode);
ReactDOM.render(listgroupInstance, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const MenuItems = (
</div>
);

React.render(MenuItems, mountNode);
ReactDOM.render(MenuItems, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ const Example = React.createClass({
}
});

React.render(<Example/>, mountNode);
ReactDOM.render(<Example/>, mountNode);
2 changes: 1 addition & 1 deletion docs/examples/ModalContained.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ const Trigger = React.createClass({
}
});

React.render(<Trigger />, mountNode);
ReactDOM.render(<Trigger />, mountNode);
Loading

0 comments on commit 049e538

Please sign in to comment.