Skip to content

Commit

Permalink
Flux - 27 - Scaffolding Image Detail
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jul 5, 2015
1 parent 7c86a66 commit e606fad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions imgur-client/src/components/image-detail.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var React = require('react');

module.exports = React.createClass({
render: function() {
return <div>
I am an image detail.
</div>
}
});
7 changes: 5 additions & 2 deletions imgur-client/src/components/image-preview.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var React = require('react');
var ReactRouter = require('react-router');
var Link = ReactRouter.Link;

module.exports = React.createClass({
getInitialState: function() {
Expand All @@ -7,15 +9,16 @@ module.exports = React.createClass({
}
},
render: function() {
return <div
return <Link
to={"images/" + this.props.id}
className="image-preview"
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
>
{this.props.animated && this.state.hovering ? this.video() : this.image()}
{this.props.animated && !this.state.hovering ? this.icon() : null }
{this.state.hovering ? this.inset() : null}
</div>
</Link>
},
inset: function() {
return <div className="inset">
Expand Down
2 changes: 2 additions & 0 deletions imgur-client/src/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ var Route = ReactRouter.Route;

var Main = require('./components/main');
var Topic = require('./components/topic');
var ImageDetail = require('./components/image-detail');

module.exports = (
<Router history={new HashHistory}>
<Route path="/" component={Main}>
<Route path="topics/:id" component={Topic} />
<Route path="images/:id" component={ImageDetail} />
</Route>
</Router>
)

0 comments on commit e606fad

Please sign in to comment.