File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change
1
+ var React = require ( 'react' ) ;
2
+
3
+ module . exports = React . createClass ( {
4
+ render : function ( ) {
5
+ return < div >
6
+ I am an image detail.
7
+ </ div >
8
+ }
9
+ } ) ;
Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
+ var ReactRouter = require ( 'react-router' ) ;
3
+ var Link = ReactRouter . Link ;
2
4
3
5
module . exports = React . createClass ( {
4
6
getInitialState : function ( ) {
@@ -7,15 +9,16 @@ module.exports = React.createClass({
7
9
}
8
10
} ,
9
11
render : function ( ) {
10
- return < div
12
+ return < Link
13
+ to = { "images/" + this . props . id }
11
14
className = "image-preview"
12
15
onMouseEnter = { this . handleMouseEnter }
13
16
onMouseLeave = { this . handleMouseLeave }
14
17
>
15
18
{ this . props . animated && this . state . hovering ? this . video ( ) : this . image ( ) }
16
19
{ this . props . animated && ! this . state . hovering ? this . icon ( ) : null }
17
20
{ this . state . hovering ? this . inset ( ) : null }
18
- </ div >
21
+ </ Link >
19
22
} ,
20
23
inset : function ( ) {
21
24
return < div className = "inset" >
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ var Route = ReactRouter.Route;
6
6
7
7
var Main = require ( './components/main' ) ;
8
8
var Topic = require ( './components/topic' ) ;
9
+ var ImageDetail = require ( './components/image-detail' ) ;
9
10
10
11
module . exports = (
11
12
< Router history = { new HashHistory } >
12
13
< Route path = "/" component = { Main } >
13
14
< Route path = "topics/:id" component = { Topic } />
15
+ < Route path = "images/:id" component = { ImageDetail } />
14
16
</ Route >
15
17
</ Router >
16
18
)
You can’t perform that action at this time.
0 commit comments