8000 fix: library fixes: · coreui/coreui-icons-react@b36f7b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit b36f7b1

Browse files
committed
fix: library fixes:
- change cssModule to normal css import - delete cssModule prop - add typings - add sideEffects field - move react-dom to peerDependencies - clear code
1 parent 51b29ad commit b36f7b1

File tree

8 files changed

+44
-607
lines changed

8 files changed

+44
-607
lines changed

package-lock.json

Lines changed: 11 additions & 574 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@coreui/icons-react",
33
"version": "1.0.0-alpha.5",
44
"description": "CoreUI Icons React component",
5+
"sideEffects": "src/CIcon.css",
56
"license": "MIT",
67
"homepage": "https://coreui.io",
78
"author": {
@@ -25,6 +26,7 @@
2526
},
2627
"main": "lib/index.js",
2728
"module": "es/index.js",
29+
"types": "src/index.d.ts",
2830
"files": [
2931
"es/",
3032
"lib/",
@@ -43,7 +45,8 @@
4345
"prop-types": "^15.7.2"
4446
},
4547
"peerDependencies": {
46-
"react": "^16.13.1"
48+
"react": "^16.13.1",
49+
"react-dom": "^16.13.1"
4750
},
4851
"devDependencies": {
4952
"babel-eslint": "^10.1.0",
@@ -53,8 +56,6 @@
5356
"eslint-plugin-import": "^2.20.1",
5457
"eslint-plugin-react": "^7.19.0",
5558
"nwb": "^0.24.5",
56-
"react": "^16.13.1",
57-
"react-dom": "^16.13.1",
5859
"sinon": "^5.1.1"
5960
},
6061
"keywords": [
File renamed without changes.

src/CIcon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import CIconRaw from './CIconRaw'
3-
import style from './CIcon.module.css'
3+
import './CIcon.css'
44

55
//component - CoreUI / CIcon
6-
const CIcon = props => <CIconRaw {...props} cssModule={style}/>
6+
const CIcon = props => <CIconRaw {...props}/>
77
export default CIcon

src/CIconRaw.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import React, { useMemo, useState } from 'react'
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
4-
import { mapToCssModules, colog } from './Shared/helper'
4+
5+
const colog = () => {
6+
if (process && process.env && process.env.NODE_ENV === 'development') {
7+
console.log.apply(this, arguments);
8+
}
9+
}
510

611
const toCamelCase = (str) => {
712
return str.replace(/([-_][a-z0-9])/ig, ($1) => {
@@ -14,7 +19,6 @@ const CIconRaw = props => {
1419

1520
const {
1621
className,
17-
cssModule,
1822
//
1923
name,
2024
content,
@@ -64,11 +68,11 @@ const CIconRaw = props => {
6468
})()
6569

6670
//render
67-
const computedClasses = mapToCssModules(classNames(
71+
const computedClasses = classNames(
6872
'c-icon',
6973
computedSize && `c-icon-${computedSize}`,
7074
className
71-
), cssModule)
75+
)
7276

7377
const classes = customClasses || computedClasses
7478

@@ -108,7 +112,6 @@ const CIconRaw = props => {
108112

109113
CIconRaw.propTypes = {
110114
className: PropTypes.string,
111-
cssModule: PropTypes.object,
112115
//
113116
name: PropTypes.string,
114117
content: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),

src/Shared/helper.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/index.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
3+
interface CIconRaw {
4+
className?: string
5+
name?: string
6+
content?: string | Array<string>
7+
size?: string
8+
customClasses?: string | Array<any> | object
9+
src?: string
10+
title?: string
11+
use?: string
12+
}
13+
14+
interface CIcon extends CIconRaw {}
15+
16+
export declare const CIconRaw: (props: CIconRaw) => React.SFC<CIconRaw>;
17+
export declare const CIcon: (props: CIcon) => React.SFC<CIcon>;

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
// CoreUI Icons React index
2-
export {default as CIcon} from './CIcon';
3-
export {default as CIconRaw} from './CIconRaw';
1+
export {default as CIcon} from './CIcon'
2+
export {default as CIconRaw} from './CIconRaw'

0 commit comments

Comments
 (0)
0