File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 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'
33import classNames from 'classnames'
44import './CIcon.css'
55
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 )
911 }
1012}
1113
@@ -46,7 +48,11 @@ const CIcon = props => {
4648 return content
4749 } else if ( name && React . icons ) {
4850 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+ )
5056 }
5157 } , [ change ] )
5258
You can’t perform that action at this time.
0 commit comments