File tree 1 file changed +10
-4
lines changed
Filter options
1 file changed +10
-4
lines changed
Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ import PropTypes from 'prop-types'
3
3
import classNames from 'classnames'
4
4
import './CIcon.css'
5
5
6
- const colog = ( ...args ) => {
7
- if ( process && process . env && process . env . NODE_ENV === 'development' ) {
8
- console . warn ( ...args )
6
+ let warned = { }
7
+ const colog = ( msg , icon ) => {
8
+ if ( ! warned [ icon ] && process && process . env && process . env . NODE_ENV === 'development' ) {
9
+ warned [ icon ] = true
10
+ console . error ( msg )
9
11
}
10
12
}
11
13
@@ -46,7 +48,11 @@ const CIcon = props => {
46
48
return content
47
49
} else if ( name && React . icons ) {
48
50
return React . icons [ iconName ] ? React . icons [ iconName ] :
49
- colog ( 'Not existing icon: ' + iconName + ' in React.icons object' )
51
+ colog ( `CIcon component: icon name '${ iconName } ' does not exist in React.icons object. ` +
52
+ `To use icons by 'name' prop you need to make them available globally ` +
53
+ `by adding them to React.icons object. CIcon component docs: https://coreui.io/react/docs/components/CIcon \n` ,
54
+ iconName
55
+ )
50
56
}
51
57
} , [ change ] )
52
58
You can’t perform that action at this time.
0 commit comments