import "core-js/modules/web.dom.iterable";
import "core-js/modules/es6.array.iterator";
import "core-js/modules/es6.object.keys";
import "core-js/modules/es6.object.assign";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import { snakeCase } from "../../utils/snakeCase";
import { Spinner } from "../..";

var FileContentItem = function FileContentItem(props) {
  var actionNode = props.actionNode,
      aspect = props.aspect,
      className = props.className,
      content = props.content,
      isProtected = props.isProtected,
      loading = props.loading,
      style = props.style,
      subtitle = props.subtitle,
      title = props.title,
      otherProps = _objectWithoutPropertiesLoose(props, ["actionNode", "aspect", "className", "content", "isProtected", "loading", "style", "subtitle", "title"]);

  var kebabify = function kebabify(aspect) {
    var kebab = snakeCase(aspect);
    return "cui-content-file--" + kebab;
  };

  return React.createElement("div", _extends({
    className: "cui-content__container"
  }, otherProps), loading ? React.createElement("div", {
    className: "" + (!aspect && 'cui-content-file' || ''),
    style: {
      backgroundImage: content && "url(" + content + ")"
    }
  }, React.createElement("div", {
    className: "" + (content && 'cui-content--opacity' || '')
  }, React.createElement(Spinner, null))) : React.createElement("div", {
    className: 'cui-content-file__block' + ("" + (aspect === 'oneOne' && ' cui-no-border' || aspect === 'fourThree' && ' cui-no-border' || ''))
  }, React.createElement("div", {
    className: "" + (aspect && kebabify(aspect) || '') + ("" + (!aspect && ' cui-content-file--full' || '')) + ("" + (className && " " + className || '')),
    style: Object.assign({
      backgroundImage: content && "url(" + content + ")"
    }, style)
  }), !isProtected && actionNode && React.createElement("div", {
    className: "cui-content-file__aspect"
  }, actionNode)), React.createElement("div", {
    className: "cui-content-file__info-container"
  }, React.createElement("span", {
    className: "cui-content-file__title"
  }, loading ? 'Loading' : title), React.createElement("span", {
    className: "cui-content-file__subtitle"
  }, " ", subtitle, " ")));
};

FileContentItem.defaultProps = {
  actionNode: null,
  aspect: null,
  className: '',
  content: '',
  icon: '',
  isProtected: null,
  loading: false,
  style: null,
  subtitle: '',
  title: ''
};
FileContentItem.propTypes = {
  actionNode: PropTypes.node,
  aspect: PropTypes.oneOf(['oneOne', 'twoThree', 'fourThree', 'threeFour', 'sixteenNine', 'nineSixteen']),
  className: PropTypes.string,
  content: PropTypes.string,
  icon: PropTypes.string,
  isProtected: PropTypes.bool,
  loading: PropTypes.bool,
  style: PropTypes.object,
  subtitle: PropTypes.string,
  title: PropTypes.string
};
FileContentItem.displayName = 'FileContentItem';
export default FileContentItem;