mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
||
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import classNames from 'classnames';
|
||
|
import { mapToCssModules, tagPropType } from './utils';
|
||
|
var propTypes = {
|
||
|
tag: tagPropType,
|
||
|
active: PropTypes.bool,
|
||
|
disabled: PropTypes.bool,
|
||
|
color: PropTypes.string,
|
||
|
action: PropTypes.bool,
|
||
|
className: PropTypes.any,
|
||
|
cssModule: PropTypes.object
|
||
|
};
|
||
|
var defaultProps = {
|
||
|
tag: 'li'
|
||
|
};
|
||
|
|
||
|
var handleDisabledOnClick = function handleDisabledOnClick(e) {
|
||
|
e.preventDefault();
|
||
|
};
|
||
|
|
||
|
var ListGroupItem = function ListGroupItem(props) {
|
||
|
var className = props.className,
|
||
|
cssModule = props.cssModule,
|
||
|
Tag = props.tag,
|
||
|
active = props.active,
|
||
|
disabled = props.disabled,
|
||
|
action = props.action,
|
||
|
color = props.color,
|
||
|
attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "active", "disabled", "action", "color"]);
|
||
|
|
||
|
var 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) {
|
||
|
attributes.onClick = handleDisabledOnClick;
|
||
|
}
|
||
|
|
||
|
return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
|
||
|
className: classes
|
||
|
}));
|
||
|
};
|
||
|
|
||
|
ListGroupItem.propTypes = propTypes;
|
||
|
ListGroupItem.defaultProps = defaultProps;
|
||
|
export default ListGroupItem;
|