Skip to content

Commit 6e50ece

Browse files
taiontimdorr
authored andcommitted
Fix setting basename in examples (#3609)
1 parent e9e071c commit 6e50ece

File tree

34 files changed

+76
-44
lines changed

34 files changed

+76
-44
lines changed

examples/active-links/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ 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'
6+
57
const ACTIVE = { color: 'red' }
68

79
const App = ({ children }) => (
@@ -57,7 +59,7 @@ const About = () => (
5759
)
5860

5961
render((
60-
<Router history={browserHistory}>
62+
<Router history={withBasename(browserHistory, __dirname)}>
6163
<Route path="/" component={App}>
6264
<IndexRoute component={Index}/>
6365
<Route path="/about" component={About}/>

examples/active-links/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!doctype html public "restroom">
22
<title>Active Links Example</title>
3-
<base href="/active-links"/>
43
<link href="/global.css" rel="stylesheet"/>
54
<body>
65
<h1 class="breadcrumbs"><a href="/">React Router Examples</a> / Active Links</h1>

examples/animations/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import React from 'react'
2-
import { render } from 'react-dom'
32
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
3+
import { render } from 'react-dom'
44
import { browserHistory, Router, Route, IndexRoute, Link } from 'react-router'
5+
6+
import withBasename from '../withBasename'
7+
58
import './app.css'
69

710
const App = ({ children, location }) => (
@@ -46,7 +49,7 @@ const Page2 = () => (
4649
)
4750

4851
render((
49-
<Router history={browserHistory}>
52+
<Router history={withBasename(browserHistory, __dirname)}>
5053
<Route path="/" component={App}>
5154
<IndexRoute component={Index}/>
5255
<Route path="page1" component={Page1} />

examples/animations/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!doctype html public "restroom">
22
<title>Animation Example</title>
3-
<base href="/animations"/>
43
<link href="/global.css" rel="stylesheet"/>
54
<link href="/animations/app.css" rel="stylesheet"/>
65
<body>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { createClass } from 'react'
22
import { render } from 'react-dom'
3-
import {
4-
Router, Route, IndexRoute, browserHistory, Link, withRouter
5-
} from 'react-router'
3+
import { Router, Route, IndexRoute, browserHistory, Link, withRouter } from 'react-router'
4+
5+
import withBasename from '../withBasename'
66

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

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

examples/auth-flow-async-with-query-params/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<base href="/auth-flow-async-with-query-params"/>
54
<meta charset="utf-8">
65
<title>Authentication with query parameters</title>
76
<link rel="stylesheet" href="/global.css"/>

examples/auth-flow/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router, Route, Link, withRouter } from 'react-router'
4+
5+
import withBasename from '../withBasename'
46
import auth from './auth'
57

68
const App = React.createClass({
@@ -125,7 +127,7 @@ function requireAuth(nextState, replace) {
125127
}
126128

127129
render((
128-
<Router history={browserHistory}>
130+
<Router history={withBasename(browserHistory, __dirname)}>
129131
<Route path="/" component={App}>
130132
<Route path="login" component={Login} />
131133
<Route path="logout" component={Logout} />

examples/auth-flow/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!doctype html public "display of affection">
22
<title>Authentication Flow Example</title>
3-
<base href="/auth-flow"/>
43
<link rel="stylesheet" href="/global.css"/>
54
<body>
65
<h1 class="breadcrumbs"><a href="/">React Router Examples</a> / Auth Flow</h1>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React from 'react'
22
import { render } from 'react-dom'
33
import { browserHistory, Router } from 'react-router'
4+
5+
import withBasename from '../withBasename'
46
import routes from './config/routes'
57

6-
render(<Router history={browserHistory} routes={routes}/>, document.getElementById('example'))
8+
render((
9+
<Router history={withBasename(browserHistory, __dirname)} routes={routes}/>
10+
), document.getElementById('example'))

examples/auth-with-shared-root/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!doctype html public "indecency">
22
<title>Authentication With Shared Root Example</title>
3-
<base href="/auth-with-shared-root"/>
43
<link rel="stylesheet" href="../global.css"/>
54
<body>
65
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Auth With Shared Root</h1>

0 commit comments

Comments
 (0)