Skip to content

Commit 00c44b7

Browse files
taiontimdorr
authored andcommitted
Fix basename in examples better (#3610)
1 parent 6e50ece commit 00c44b7

File tree

17 files changed

+41
-35
lines changed

17 files changed

+41
-35
lines changed

examples/active-links/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { Router, Route, IndexRoute, Link, IndexLink, browserHistory } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66

77
const ACTIVE = { color: 'red' }
88

@@ -59,7 +59,7 @@ const About = () => (
5959
)
6060

6161
render((
62-
<Router history={withBasename(browserHistory, __dirname)}>
62+
<Router history={withExampleBasename(browserHistory, __dirname)}>
6363
<Route path="/" component={App}>
6464
<IndexRoute component={Index}/>
6565
<Route path="/about" component={About}/>

examples/animations/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
33
import { render } from 'react-dom'
44
import { browserHistory, Router, Route, IndexRoute, Link } from 'react-router'
55

6-
import withBasename from '../withBasename'
6+
import withExampleBasename from '../withExampleBasename'
77

88
import './app.css'
99

@@ -49,7 +49,7 @@ const Page2 = () => (
4949
)
5050

5151
render((
52-
<Router history={withBasename(browserHistory, __dirname)}>
52+
<Router history={withExampleBasename(browserHistory, __dirname)}>
5353
<Route path="/" component={App}>
5454
<IndexRoute component={Index}/>
5555
<Route path="page1" component={Page1} />

examples/auth-flow-async-with-query-params/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { createClass } from 'react'
22
import { render } from 'react-dom'
33
import { Router, Route, IndexRoute, browserHistory, Link, withRouter } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66

77
function App(props) {
88
return (
@@ -88,7 +88,7 @@ function serverAuth(authToken) {
8888
}
8989

9090
render((
91-
<Router history={withBasename(browserHistory, __dirname)}>
91+
<Router history={withExampleBasename(browserHistory, __dirname)}>
9292
<Route path="/" component={App}>
9393
<IndexRoute component={Form} />
9494
<Route path="page" component={Page} onEnter={requireCredentials}/>

examples/auth-flow/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router, Route, Link, withRouter } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66
import auth from './auth'
77

88
const App = React.createClass({
@@ -127,7 +127,7 @@ function requireAuth(nextState, replace) {
127127
}
128128

129129
render((
130-
<Router history={withBasename(browserHistory, __dirname)}>
130+
<Router history={withExampleBasename(browserHistory, __dirname)}>
131131
<Route path="/" component={App}>
132132
<Route path="login" component={Login} />
133133
<Route path="logout" component={Logout} />

examples/auth-with-shared-root/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66
import routes from './config/routes'
77

88
render((
9-
<Router history={withBasename(browserHistory, __dirname)} routes={routes}/>
9+
<Router
10+
history={withExampleBasename(browserHistory, __dirname)}
11+
routes={routes}
12+
/>
1013
), document.getElementById('example'))

examples/breadcrumbs/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router, Route, Link } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66

77
import './app.css'
88

@@ -60,7 +60,7 @@ Orders.title = 'Orders'
6060
Orders.path = '/orders'
6161

6262
render((
63-
<Router history={withBasename(browserHistory, __dirname)}>
63+
<Router history={withExampleBasename(browserHistory, __dirname)}>
6464
<Route path={App.path} component={App}>
6565
<Route path={Products.path} component={Products} />
6666
<Route path={Orders.path} component={Orders} />

examples/confirming-navigation/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router, Route, Link, withRouter } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66

77
const App = React.createClass({
88
render() {
@@ -76,7 +76,7 @@ const Form = withRouter(
7676
)
7777

7878
render((
79-
<Router history={withBasename(browserHistory, __dirname)}>
79+
<Router history={withExampleBasename(browserHistory, __dirname)}>
8080
<Route path="/" component={App}>
8181
<Route path="dashboard" component={Dashboard} />
8282
<Route path="form" component={Form} />

examples/dynamic-segments/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router, Route, Link, Redirect } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66

77
const App = ({ children }) => (
88
<div>
@@ -33,7 +33,7 @@ const Task = ({ params: { userID, taskID } }) => (
3333
)
3434

3535
render((
36-
<Router history={withBasename(browserHistory, __dirname)}>
36+
<Router history={withExampleBasename(browserHistory, __dirname)}>
3737
<Route path="/" component={App}>
3838
<Route path="user/:userID" component={User}>
3939
<Route path="tasks/:taskID" component={Task} />

examples/huge-apps/app.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { Router, browserHistory } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66
import './stubs/COURSES'
77

8-
const route = {
8+
const rootRoute = {
99
childRoutes: [ {
1010
path: '/',
1111
component: require('./components/App'),
@@ -20,7 +20,10 @@ const route = {
2020
}
2121

2222
render((
23-
<Router history={withBasename(browserHistory, __dirname)} routes={route} />
23+
<Router
24+
history={withExampleBasename(browserHistory, __dirname)}
25+
routes={rootRoute}
26+
/>
2427
), document.getElementById('example'))
2528

2629
// I've unrolled the recursive directory loop that is happening above to get a

examples/master-detail/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { render, findDOMNode } from 'react-dom'
33
import { browserHistory, Router, Route, IndexRoute, Link, withRouter } from 'react-router'
44

5-
import withBasename from '../withBasename'
5+
import withExampleBasename from '../withExampleBasename'
66
import ContactStore from './ContactStore'
77

88
import './app.css'
@@ -151,7 +151,7 @@ const NotFound = React.createClass({
151151
})
152152

153153
render((
154-
<Router history={withBasename(browserHistory, __dirname)}>
154+
<Router history={withExampleBasename(browserHistory, __dirname)}>
155155
<Route path="/" component={App}>
156156
<IndexRoute component={Index} />
157157
<Route path="contact/new" component={NewContact} />

0 commit comments

Comments
 (0)