|
1 | 1 | import React, { Component } from "react"; |
2 | 2 | import { PropTypes } from "prop-types"; |
3 | 3 | import "./index.less"; |
4 | | -class PanThumb extends Component { |
5 | | - static propTypes = { |
6 | | - image: PropTypes.string.isRequired, |
7 | | - zIndex: PropTypes.number, |
8 | | - width: PropTypes.string, |
9 | | - height: PropTypes.string, |
10 | | - className: PropTypes.string, |
11 | | - }; |
12 | | - static defaultProps = { |
13 | | - width: "150px", |
14 | | - height: "150px", |
15 | | - zIndex: 1, |
16 | | - className:"" |
17 | | - }; |
18 | | - render() { |
19 | | - const { image, zIndex, width, height,className } = this.props; |
20 | | - return ( |
21 | | - <div |
22 | | - className={`pan-item ${className}`} |
23 | | - style={{ |
24 | | - zIndex, |
25 | | - height, |
26 | | - width, |
27 | | - }} |
28 | | - > |
29 | | - <div className="pan-info"> |
30 | | - <div className="pan-info-roles-container">{this.props.children}</div> |
31 | | - </div> |
32 | | - <img src={image} className="pan-thumb" alt=""/> |
| 4 | + |
| 5 | +const PanThumb = (props) => { |
| 6 | + const { image, zIndex, width, height, className } = props; |
| 7 | + return ( |
| 8 | + <div |
| 9 | + className={`pan-item ${className}`} |
| 10 | + style={{ |
| 11 | + zIndex, |
| 12 | + height, |
| 13 | + width, |
| 14 | + }} |
| 15 | + > |
| 16 | + <div className="pan-info"> |
| 17 | + <div className="pan-info-roles-container">{props.children}</div> |
33 | 18 | </div> |
34 | | - ); |
35 | | - } |
36 | | -} |
| 19 | + <img src={image} className="pan-thumb" alt="" /> |
| 20 | + </div> |
| 21 | + ); |
| 22 | +}; |
| 23 | + |
| 24 | +PanThumb.prototype = { |
| 25 | + image: PropTypes.string.isRequired, |
| 26 | + zIndex: PropTypes.number, |
| 27 | + width: PropTypes.string, |
| 28 | + height: PropTypes.string, |
| 29 | + className: PropTypes.string, |
| 30 | +}; |
| 31 | + |
| 32 | +PanThumb.defaultProps = { |
| 33 | + width: "150px", |
| 34 | + height: "150px", |
| 35 | + zIndex: 1, |
| 36 | + className: "", |
| 37 | +}; |
37 | 38 |
|
38 | 39 | export default PanThumb; |
0 commit comments