"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));

var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));

var _ListItemIcon = _interopRequireDefault(require("@material-ui/core/ListItemIcon"));

var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// import { withStyles } from '@material-ui/core/styles';
const SongLiteItemContents = ({
  album,
  artist,
  coverArtUrl,
  title,
  year,
  id,
  idx,
  showListIndex,
  showMeta,
  showCover,
  showYear,
  coverSize,
  onClick,
  ref
}) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showCover && /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, {
  style: {
    width: coverSize,
    height: coverSize
  }
}, /*#__PURE__*/_react.default.createElement("img", {
  alt: title,
  src: coverArtUrl,
  style: {
    width: coverSize,
    height: coverSize
  }
})), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, showListIndex ? idx + 1 + '. ' : '', title, showMeta && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_Typography.default, {
  variant: "caption"
}, artist, " - ", album, showYear && " - (".concat(year, ")")))));

const SongListItem = props => {
  const {
    id,
    onClick
  } = props;
  return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
    "data-song-id": id,
    id: 'songs-li-' + id,
    button: true,
    onClick: onClick && onClick.bind(onClick.prototype, id)
  }, /*#__PURE__*/_react.default.createElement(SongLiteItemContents, props));
};

SongListItem.propTypes = {
  album: _propTypes.default.string,
  artist: _propTypes.default.string,
  coverArtUrl: _propTypes.default.string,
  title: _propTypes.default.string,
  year: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
  id: _propTypes.default.string,
  idx: _propTypes.default.number,
  showListIndex: _propTypes.default.bool,
  showMeta: _propTypes.default.bool,
  showCover: _propTypes.default.bool,
  showYear: _propTypes.default.bool,
  coverSize: _propTypes.default.number,
  onClick: _propTypes.default.func,
  ref: _propTypes.default.any
};
var _default = SongListItem;
exports.default = _default;
SongLiteItemContents.propTypes = SongListItem.propTypes;