1
- import React from 'react' ;
2
- import PropTypes from 'prop-types' ;
3
- import classNames from 'classnames' ;
4
- import { tagPropType } from './Shared/helper.js' ;
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+ import { tagPropType } from './Shared/helper.js'
5
5
6
6
//component - CoreUI / CImg
7
-
8
- const CImg = props => {
7
+ const CImg = props => {
9
8
10
9
const {
11
10
className,
@@ -22,30 +21,22 @@ const CImg = props=>{
22
21
placeholderColor,
23
22
fluidGrow,
24
23
...attributes
25
- } = props ;
24
+ } = props
26
25
27
- const alignClass = ( ( ) => {
28
- if ( align === 'center' ) {
29
- return 'mx-auto'
30
- } else if ( align === 'right' ) {
31
- return 'float-right'
32
- } else if ( align === 'left' ) {
33
- return 'float-left'
34
- }
35
- return null
36
- } ) ( ) ;
26
+ const alignClass = align === 'center' ? 'mx-auto' :
27
+ align === 'right' ? 'float-right' :
28
+ align === 'left' ? 'float-left' : ''
37
29
38
30
// render
39
-
40
31
const classes = classNames (
41
32
className ,
42
33
alignClass ,
43
- thumbnail ? 'img-thumbnail' : null ,
44
- fluid || fluidGrow ? 'img-fluid' : null ,
45
- fluidGrow ? 'w-100' : null ,
46
- block ? 'd-block' : null ,
47
- shape ? shape : null ,
48
- ) ;
34
+ thumbnail && 'img-thumbnail' ,
35
+ fluid || fluidGrow && 'img-fluid' ,
36
+ fluidGrow && 'w-100' ,
37
+ block && 'd-block' ,
38
+ shape
39
+ )
49
40
50
41
return (
51
42
src ?
@@ -55,7 +46,8 @@ const CImg = props=>{
55
46
width = { width }
56
47
height = { height }
57
48
{ ...attributes }
58
- ref = { innerRef } /> :
49
+ ref = { innerRef }
50
+ /> :
59
51
< svg
60
52
className = { classes }
61
53
width = { width }
@@ -64,7 +56,7 @@ const CImg = props=>{
64
56
{ ...attributes }
65
57
ref = { innerRef }
66
58
/>
67
- ) ;
59
+ )
68
60
69
61
}
70
62
@@ -74,7 +66,6 @@ CImg.propTypes = {
74
66
//
75
67
innerRef : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . func , PropTypes . string ] ) ,
76
68
src : PropTypes . string ,
77
- alt : PropTypes . string ,
78
69
width : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
79
70
height : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
80
71
block : PropTypes . bool ,
@@ -90,4 +81,4 @@ CImg.defaultProps = {
90
81
placeholderColor : 'transparent'
91
82
} ;
92
83
93
- export default CImg ;
84
+ export default CImg
0 commit comments