Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reactV14] add history dependency #1766

Merged
merged 1 commit into from
Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "webpack --config webpack-production.config.js --progress --colors --profile"
},
"dependencies": {
"codemirror": "^5.5.0"
"codemirror": "^5.5.0",
"history": "^1.11.1"
},
"devDependencies": {
"raw-loader": "^0.5.1",
Expand Down
18 changes: 9 additions & 9 deletions docs/src/app/app-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ const TimePicker = require('./components/pages/components/time-picker');
const Toolbars = require('./components/pages/components/toolbars');


/** Routes: https://github.com/rackt/react-router/blob/master/docs/api/components/Route.md
*
* Routes are used to declare your view hierarchy.
*
* Say you go to http://material-ui.com/#/components/paper
* The react router will search for a route named 'paper' and will recursively render its
* handler and its parent handler like so: Paper > Components > Master
*/

/**
* Routes: https://github.com/rackt/react-router/blob/master/docs/api/components/Route.md
*
* Routes are used to declare your view hierarchy.
*
* Say you go to http://material-ui.com/#/components/paper
* The react router will search for a route named 'paper' and will recursively render its
* handler and its parent handler like so: Paper > Components > Master
*/
const AppRoutes = (
<Route path="/" component={Master}>
<Route path="home" component={Home} />
Expand Down
6 changes: 4 additions & 2 deletions docs/src/app/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const React = require('react');
const ReactDOM = require('react-dom');
const {Router} = require('react-router');
const AppRoutes = require('./app-routes.jsx');
const injectTapEventPlugin = require("react-tap-event-plugin");
const injectTapEventPlugin = require('react-tap-event-plugin');
const createBrowserHistory = require('history/lib/createBrowserHistory');
const history = createBrowserHistory()

//Needed for React Developer Tools
window.React = React;
Expand All @@ -17,6 +19,6 @@ injectTapEventPlugin();
* Render the main app component. You can read more about the react-router here:
* https://github.com/rackt/react-router/blob/master/docs/guides/overview.md
*/
ReactDOM.render(<Router>
ReactDOM.render(<Router history={history}>
{AppRoutes}
</Router>, document.getElementById('app'));
6 changes: 3 additions & 3 deletions docs/src/app/components/master.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,17 @@ const Master = React.createClass({
value="1"
label="GETTING STARTED"
style={styles.tab}
route="get-started" />
route="/get-started" />
<Tab
value="2"
label="CUSTOMIZATION"
style={styles.tab}
route="customization"/>
route="/customization"/>
<Tab
value="3"
label="COMPONENTS"
style={styles.tab}
route="components"/>
route="/components"/>
</Tabs>
</div>
</Paper>
Expand Down
12 changes: 8 additions & 4 deletions docs/src/app/components/pages/home.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const React = require('react');
const Router = require('react-router');
const {History} = require('react-router');
const { Mixins, RaisedButton, Styles } = require('material-ui');
const HomeFeature = require('./home-feature');
const FullWidthSection = require('../full-width-section');
Expand All @@ -12,7 +12,11 @@ const DefaultRawTheme = Styles.LightRawTheme;

const HomePage = React.createClass({

mixins: [StylePropable, StyleResizable],
mixins: [
StylePropable,
StyleResizable,
History,
],

contextTypes: {
router: React.PropTypes.func
Expand Down Expand Up @@ -208,8 +212,8 @@ const HomePage = React.createClass({
},

_onDemoClick() {
this.context.router.transitionTo('components');
}
this.history.pushState(null, '/components');
},
});

module.exports = HomePage;