Skip to content

Commit df264a8

Browse files
jlaramieTheSharpieOne
authored andcommitted
feat(ListGroup*): Added missing cssModule support (#784)
1 parent bc03273 commit df264a8

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/ListGroupItem.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import classNames from 'classnames';
4+
import { mapToCssModules } from './utils';
45

56
const propTypes = {
67
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
@@ -9,6 +10,7 @@ const propTypes = {
910
color: PropTypes.string,
1011
action: PropTypes.bool,
1112
className: PropTypes.any,
13+
cssModule: PropTypes.object,
1214
};
1315

1416
const defaultProps = {
@@ -22,21 +24,22 @@ const handleDisabledOnClick = (e) => {
2224
const ListGroupItem = (props) => {
2325
const {
2426
className,
27+
cssModule,
2528
tag: Tag,
2629
active,
2730
disabled,
2831
action,
2932
color,
3033
...attributes
3134
} = props;
32-
const classes = classNames(
35+
const classes = mapToCssModules(classNames(
3336
className,
3437
active ? 'active' : false,
3538
disabled ? 'disabled' : false,
3639
action ? 'list-group-item-action' : false,
3740
color ? `list-group-item-${color}` : false,
3841
'list-group-item'
39-
);
42+
), cssModule);
4043

4144
// Prevent click event when disabled.
4245
if (disabled) {

src/ListGroupItemHeading.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import classNames from 'classnames';
4+
import { mapToCssModules } from './utils';
45

56
const propTypes = {
67
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
7-
className: PropTypes.any
8+
className: PropTypes.any,
9+
cssModule: PropTypes.object,
810
};
911

1012
const defaultProps = {
@@ -14,13 +16,14 @@ const defaultProps = {
1416
const ListGroupItemHeading = (props) => {
1517
const {
1618
className,
19+
cssModule,
1720
tag: Tag,
1821
...attributes
1922
} = props;
20-
const classes = classNames(
23+
const classes = mapToCssModules(classNames(
2124
className,
2225
'list-group-item-heading'
23-
);
26+
), cssModule);
2427

2528
return (
2629
<Tag {...attributes} className={classes} />

src/ListGroupItemText.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import classNames from 'classnames';
4+
import { mapToCssModules } from './utils';
45

56
const propTypes = {
67
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
7-
className: PropTypes.any
8+
className: PropTypes.any,
9+
cssModule: PropTypes.object,
810
};
911

1012
const defaultProps = {
@@ -14,13 +16,14 @@ const defaultProps = {
1416
const ListGroupItemText = (props) => {
1517
const {
1618
className,
19+
cssModule,
1720
tag: Tag,
1821
...attributes
1922
} = props;
20-
const classes = classNames(
23+
const classes = mapToCssModules(classNames(
2124
className,
2225
'list-group-item-text'
23-
);
26+
), cssModule);
2427

2528
return (
2629
<Tag {...attributes} className={classes} />

0 commit comments

Comments
 (0)