Skip to content

Commit 8c65f88

Browse files
committed
refactor: CCardLink: optimize definition
1 parent fe1800e commit 8c65f88

File tree

2 files changed

+7
-39
lines changed

2 files changed

+7
-39
lines changed

src/CCardLink.js

+6-38
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,10 @@
1-
import React from 'react';
2-
import PropTypes from 'prop-types';
3-
import classNames from 'classnames';
4-
import {tagPropType, mapToCssModules} from './Shared/helper.js';
5-
import CLink from './CLink';
6-
7-
//component - CoreUI / CCardLink
8-
9-
const CCardLink = props=>{
10-
11-
const {
12-
className,
13-
cssModule,
14-
//
15-
...attributes
16-
} = props;
17-
18-
//render
19-
20-
const classes = mapToCssModules(classNames(
21-
className,
22-
'card-link'
23-
), cssModule);
1+
import React from 'react'
2+
import CLink from './CLink'
243

4+
const CCardLink = props => {
255
return (
26-
<CLink {...attributes} className={classes} />
27-
);
28-
6+
<CLink {...props} className={['card-link', props.className]}/>
7+
)
298
}
309

31-
CCardLink.propTypes = {
32-
tag: tagPropType,
33-
className: PropTypes.string,
34-
cssModule: PropTypes.object,
35-
//
36-
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
37-
};
38-
39-
CCardLink.defaultProps = {
40-
};
41-
42-
export default CCardLink;
10+
export default CCardLink

src/CLink.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ const CLink = props => {
5252
}
5353

5454
CLink.propTypes = {
55-
className: PropTypes.string,
5655
cssModule: PropTypes.object,
5756
//
5857
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
5958
active: PropTypes.bool,
6059
href: PropTypes.string,
6160
onClick: PropTypes.func,
6261
...NavLink.propTypes,
62+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
6363
to: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
6464
}
6565

0 commit comments

Comments
 (0)