@@ -2,31 +2,34 @@ import React, { Component, PropTypes } from 'react';
22import { Col } from 'react-bootstrap' ;
33import filesize from 'filesize' ;
44
5- const FileUploadItem = ( { file, height, width } ) => {
6- let image = null ;
5+ export default class FileUploadItem extends Component {
6+ static propTypes = {
7+ onClick : PropTypes . func ,
8+ file : PropTypes . object . isRequired ,
9+ height : PropTypes . string ,
10+ width : PropTypes . string
11+ } ;
712
8- if ( file . type . match ( / i m a g e / ) ) {
9- image = < img height = { height } width = { width } src = { file . preview } /> ;
10- }
13+ static defaultProps = {
14+ height : "150px" ,
15+ width : "150px"
16+ } ;
1117
12- return (
13- < Col xs = { 4 } md = { 4 } >
14- { image }
15- < p > { file . name } </ p >
16- < p > { filesize ( file . size ) } </ p >
17- </ Col >
18- ) ;
19- } ;
18+ render ( ) {
19+ let { file, height, width } = this . props ;
2020
21- FileUploadItem . propTypes = {
22- file : PropTypes . object . isRequired ,
23- height : PropTypes . string ,
24- width : PropTypes . string
25- } ;
21+ let image = null ;
2622
27- FileUploadItem . defaultProps = {
28- height : "150px" ,
29- width : "150px"
30- } ;
23+ if ( file . type . match ( / i m a g e / ) ) {
24+ image = < img height = { height } width = { width } src = { file . preview } /> ;
25+ }
3126
32- export default FileUploadItem ;
27+ return (
28+ < Col xs = { 4 } md = { 4 } >
29+ { image }
30+ < p > { file . name } </ p >
31+ < p > { filesize ( file . size ) } </ p >
32+ </ Col >
33+ ) ;
34+ }
35+ } ;
0 commit comments