Skip to content

Commit 5df5441

Browse files
committed
Merge pull request #145 from bobeagan/examples-cleanup
update examples to be easier to play with
2 parents ee1a620 + 5759fb3 commit 5df5441

File tree

27 files changed

+119
-52
lines changed

27 files changed

+119
-52
lines changed

examples/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### React Router Examples
2+
3+
In order to try out the examples, you need to follow these steps:
4+
5+
1. Clone this repo
6+
1. Run `npm -g install webpack`, if you don't have it installed already
7+
1. Run `npm install` from the repo's root directory
8+
1. Run `./script/build-examples` from the repo's root directory
9+
1. Point your browser to the `index.html` location in this directory

examples/animations/app.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.Image {
2+
position: relative;
3+
}
4+
5+
.Image img {
6+
position: absolute;
7+
top: 0;
8+
left: 0;
9+
height: 400;
10+
width: 400;
11+
background: gray;
12+
}
13+
14+
.example-enter {
15+
opacity: 0.01;
16+
transition: opacity .5s ease-in;
17+
}
18+
19+
.example-enter.example-enter-active {
20+
opacity: 1;
21+
}
22+
23+
.example-leave {
24+
opacity: 1;
25+
transition: opacity .5s ease-in;
26+
}
27+
28+
.example-leave.example-leave-active {
29+
opacity: 0.01;
30+
}

examples/animations/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ var routes = (
4141
</Routes>
4242
);
4343

44-
React.renderComponent(routes, document.body);
44+
React.renderComponent(routes, document.getElementById('example'));

examples/animations/index.html

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,8 @@
11
<!doctype html public "restroom">
22
<title>Animation Example</title>
3-
<link href="../app.css" rel="stylesheet"/>
4-
<style>
5-
.Image {
6-
position: relative;
7-
}
8-
9-
.Image img {
10-
position: absolute;
11-
top: 0;
12-
left: 0;
13-
height: 400;
14-
width: 400;
15-
background: gray;
16-
}
17-
18-
.example-enter {
19-
opacity: 0.01;
20-
transition: opacity .5s ease-in;
21-
}
22-
23-
.example-enter.example-enter-active {
24-
opacity: 1;
25-
}
26-
27-
.example-leave {
28-
opacity: 1;
29-
transition: opacity .5s ease-in;
30-
}
31-
32-
.example-leave.example-leave-active {
33-
opacity: 0.01;
34-
}
35-
</style>
3+
<link href="../global.css" rel="stylesheet"/>
4+
<link href="app.css" rel="stylesheet"/>
365
<body>
6+
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Animations</h1>
7+
<div id="example"/>
378
<script src="../build/animations.js"></script>

examples/auth-flow/app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var App = React.createClass({
2929
<Link to="login">Sign in</Link>;
3030
return (
3131
<div>
32-
<h1>Auth User Flow</h1>
3332
<ul>
3433
<li>{loginOrOut}</li>
3534
<li><Link to="about">About</Link></li>
@@ -190,4 +189,4 @@ var routes = (
190189
</Routes>
191190
);
192191

193-
React.renderComponent(routes, document.body);
192+
React.renderComponent(routes, document.getElementById('example'));

examples/auth-flow/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!doctype html public "display of affection">
22
<title>Authentication Flow Example</title>
3-
<link rel="stylesheet" href="../app.css"/>
3+
<link rel="stylesheet" href="../global.css"/>
44
<body>
5+
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Auth Flow</h1>
6+
<div id="example"/>
57
<script src="../build/auth-flow.js"></script>
68

examples/data-flow/app.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ a.active {
1111
color: hsl(20, 50%, 50%);
1212
}
1313

14+
#example {
15+
position: absolute;
16+
}
17+
1418
.App {
1519
position: absolute;
1620
top: 0;
1721
left: 0;
1822
right: 0;
1923
bottom: 0;
24+
width: 500px;
25+
height: 500px;
2026
}
2127

2228
.Master {

examples/data-flow/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ var routes = (
7272
</Routes>
7373
);
7474

75-
React.renderComponent(routes, document.body);
75+
React.renderComponent(routes, document.getElementById('example'));

examples/data-flow/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!doctype html public "embarassment">
22
<title>Data Flow Example</title>
3+
<link href="../global.css" rel="stylesheet"/>
34
<link href="app.css" rel="stylesheet"/>
45
<body>
6+
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Data Flow</h1>
7+
<div id="example"/>
58
<script src="../build/data-flow.js"></script>
6-

examples/dynamic-segments/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ var routes = (
5555
</Routes>
5656
);
5757

58-
React.renderComponent(routes, document.body);
58+
React.renderComponent(routes, document.getElementById('example'));

0 commit comments

Comments
 (0)