Skip to content

Commit

Permalink
feat(ListGroup*): Added missing cssModule support (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaramie authored and TheSharpieOne committed Jan 18, 2018
1 parent bc03273 commit df264a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/ListGroupItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';

const propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
Expand All @@ -9,6 +10,7 @@ const propTypes = {
color: PropTypes.string,
action: PropTypes.bool,
className: PropTypes.any,
cssModule: PropTypes.object,
};

const defaultProps = {
Expand All @@ -22,21 +24,22 @@ const handleDisabledOnClick = (e) => {
const ListGroupItem = (props) => {
const {
className,
cssModule,
tag: Tag,
active,
disabled,
action,
color,
...attributes
} = props;
const classes = classNames(
const classes = mapToCssModules(classNames(
className,
active ? 'active' : false,
disabled ? 'disabled' : false,
action ? 'list-group-item-action' : false,
color ? `list-group-item-${color}` : false,
'list-group-item'
);
), cssModule);

// Prevent click event when disabled.
if (disabled) {
Expand Down
9 changes: 6 additions & 3 deletions src/ListGroupItemHeading.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';

const propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
className: PropTypes.any
className: PropTypes.any,
cssModule: PropTypes.object,
};

const defaultProps = {
Expand All @@ -14,13 +16,14 @@ const defaultProps = {
const ListGroupItemHeading = (props) => {
const {
className,
cssModule,
tag: Tag,
...attributes
} = props;
const classes = classNames(
const classes = mapToCssModules(classNames(
className,
'list-group-item-heading'
);
), cssModule);

return (
<Tag {...attributes} className={classes} />
Expand Down
9 changes: 6 additions & 3 deletions src/ListGroupItemText.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';

const propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
className: PropTypes.any
className: PropTypes.any,
cssModule: PropTypes.object,
};

const defaultProps = {
Expand All @@ -14,13 +16,14 @@ const defaultProps = {
const ListGroupItemText = (props) => {
const {
className,
cssModule,
tag: Tag,
...attributes
} = props;
const classes = classNames(
const classes = mapToCssModules(classNames(
className,
'list-group-item-text'
);
), cssModule);

return (
<Tag {...attributes} className={classes} />
Expand Down

0 comments on commit df264a8

Please sign in to comment.