File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
imgur-client/src/components Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,33 @@ module.exports = React.createClass({
1717 } ,
1818 render : function ( ) {
1919 return < div >
20- { this . state . image }
20+ { this . state . image ? this . renderContent ( ) : null }
2121 </ div >
2222 } ,
23+ renderContent : function ( ) {
24+ return < div >
25+ < div className = "panel panel-default" >
26+ < div className = "panel-heading" >
27+ < h4 > { this . state . image . title } </ h4 >
28+ </ div >
29+ < div className = "panel-body" >
30+ { this . renderImage ( ) }
31+ </ div >
32+ < div className = "panel-footer" >
33+ < h5 > { this . state . image . description } </ h5 >
34+ </ div >
35+ </ div >
36+ </ div >
37+ } ,
38+ renderImage : function ( ) {
39+ if ( this . state . image . animated ) {
40+ return < video preload = "auto" autoPlay = "autoplay" loop = "loop" webkit-playsinline >
41+ < source src = { this . state . image . mp4 } type = "video/mp4" > </ source >
42+ </ video >
43+ } else {
44+ return < img src = { this . state . image . link } />
45+ }
46+ } ,
2347 onChange : function ( ) {
2448 this . setState ( {
2549 image : ImageStore . find ( this . props . params . id )
You can’t perform that action at this time.
0 commit comments