File tree Expand file tree Collapse file tree 1 file changed +5
-65
lines changed Expand file tree Collapse file tree 1 file changed +5
-65
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
2- import PropTypes from 'prop-types' ;
3- import classNames from 'classnames' ;
4- import { mapToCssModules } from './Shared/helper' ;
5- import CIconRaw from './CIconRaw' ;
6- import style from './CIcon.module.css' ;
1+ import React from 'react'
2+ import CIconRaw from './CIconRaw'
3+ import style from './CIcon.module.css'
74
85//component - CoreUI / CIcon
9-
10- const CIcon = props => {
11-
12- const {
13- tag : Tag ,
14- className,
15- cssModule,
16- //
17- name,
18- size,
19- ...attributes
20- } = props ;
21-
22- //render
23-
24- let type = 'svg' ;
25-
26- if ( typeof name == 'object' ) {
27- switch ( name . type ) {
28- case 'class' :
29- type = 'class' ;
30- break ;
31- default :
32- }
33- }
34-
35- if ( type === 'svg' ) {
36- return (
37- < CIconRaw { ...attributes } name = { name } size = { size } className = { className } />
38- ) ;
39- }
40-
41- const classes = ( classNames (
42- mapToCssModules ( className , Object . assign ( style , cssModule ) ) ,
43- type === 'name' ? name :
44- type === 'class' ? name . className : null ,
45- size ? 'c-icon-' + size : null
46- ) ) ;
47-
48- return (
49- < Tag { ...attributes } className = { classes } />
50- ) ;
51-
52- } ;
53-
54- CIcon . propTypes = {
55- tag : PropTypes . string ,
56- className : PropTypes . string ,
57- cssModule : PropTypes . object ,
58- //
59- name : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . string ] ) ,
60- size : PropTypes . string
61- } ;
62-
63- CIcon . defaultProps = {
64- tag : 'i'
65- } ;
66-
67- export default CIcon ;
6+ const CIcon = props => < CIconRaw { ...props } cssModule = { style } />
7+ export default CIcon
You can’t perform that action at this time.
0 commit comments