|
1 | 1 | import React from 'react'; |
2 | | -import PropTypes from 'prop-types'; |
3 | | - |
4 | 2 | import Icon from '../icon/icon'; |
5 | 3 |
|
6 | | -const Thumbnail = ({ thumbnailData, iconExtraClasses, contentTypeIconPath }) => { |
7 | | - const renderContentTypeIcon = () => { |
| 4 | +interface ThumbnailProps { |
| 5 | + thumbnailData: { |
| 6 | + mimeType: string; |
| 7 | + resource: string; |
| 8 | + }; |
| 9 | + iconExtraClasses?: string; |
| 10 | + contentTypeIconPath?: string; |
| 11 | +} |
| 12 | + |
| 13 | +const Thumbnail = ({ thumbnailData, iconExtraClasses, contentTypeIconPath }: ThumbnailProps) => { |
| 14 | + const renderContentTypeIcon = (): JSX.Element | null => { |
8 | 15 | if (!contentTypeIconPath) { |
9 | 16 | return null; |
10 | 17 | } |
@@ -32,18 +39,4 @@ const Thumbnail = ({ thumbnailData, iconExtraClasses, contentTypeIconPath }) => |
32 | 39 | ); |
33 | 40 | }; |
34 | 41 |
|
35 | | -Thumbnail.propTypes = { |
36 | | - thumbnailData: PropTypes.shape({ |
37 | | - mimeType: PropTypes.string.isRequired, |
38 | | - resource: PropTypes.string.isRequired, |
39 | | - }).isRequired, |
40 | | - iconExtraClasses: PropTypes.string, |
41 | | - contentTypeIconPath: PropTypes.string, |
42 | | -}; |
43 | | - |
44 | | -Thumbnail.defaultProps = { |
45 | | - iconExtraClasses: null, |
46 | | - contentTypeIconPath: null, |
47 | | -}; |
48 | | - |
49 | 42 | export default Thumbnail; |
0 commit comments