1+ 'use strict' ;
2+
3+ Object . defineProperty ( exports , '__esModule' , {
4+ value : true
5+ } ) ;
6+
7+ var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
8+
9+ var _createClass = ( function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( 'value' in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ) ( ) ;
10+
11+ var _get = function get ( _x , _x2 , _x3 ) { var _again = true ; _function: while ( _again ) { var object = _x , property = _x2 , receiver = _x3 ; desc = parent = getter = undefined ; _again = false ; if ( object === null ) object = Function . prototype ; var desc = Object . getOwnPropertyDescriptor ( object , property ) ; if ( desc === undefined ) { var parent = Object . getPrototypeOf ( object ) ; if ( parent === null ) { return undefined ; } else { _x = parent ; _x2 = property ; _x3 = receiver ; _again = true ; continue _function; } } else if ( 'value' in desc ) { return desc . value ; } else { var getter = desc . get ; if ( getter === undefined ) { return undefined ; } return getter . call ( receiver ) ; } } } ;
12+
13+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { 'default' : obj } ; }
14+
15+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } }
16+
17+ function _inherits ( subClass , superClass ) { if ( typeof superClass !== 'function' && superClass !== null ) { throw new TypeError ( 'Super expression must either be null or a function, not ' + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
18+
19+ var _react = require ( 'react' ) ;
20+
21+ var _react2 = _interopRequireDefault ( _react ) ;
22+
23+ var Image = ( function ( _React$Component ) {
24+ _inherits ( Image , _React$Component ) ;
25+
26+ function Image ( ) {
27+ var _this = this ;
28+
29+ _classCallCheck ( this , Image ) ;
30+
31+ _get ( Object . getPrototypeOf ( Image . prototype ) , 'constructor' , this ) . call ( this ) ;
32+
33+ this . fadeIn = function ( ) {
34+ _this . setState ( { opacity : 1 } ) ;
35+ } ;
36+
37+ this . state = {
38+ opacity : 0
39+ } ;
40+ }
41+
42+ _createClass ( Image , [ {
43+ key : 'render' ,
44+ value : function render ( ) {
45+ //this vs including an Object.assign polyfill
46+ var style = this . props . style || { } ;
47+ style . transition = 'opacity ' + ( this . props . speed || 1 ) + 's' ;
48+ style . opacity = this . state . opacity ;
49+
50+ return _react2 [ 'default' ] . createElement ( 'img' , _extends ( { } , this . props , {
51+ style : style ,
52+ src : this . props . src ,
53+ onLoad : this . fadeIn
54+ } ) ) ;
55+ }
56+ } ] ) ;
57+
58+ return Image ;
59+ } ) ( _react2 [ 'default' ] . Component ) ;
60+
61+ exports [ 'default' ] = Image ;
62+ module . exports = exports [ 'default' ] ;
0 commit comments