"use strict";

exports.__esModule = true;
exports.default = FeedObjectSkeleton;

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

var _Widget = _interopRequireDefault(require("../Widget"));

var _styles = require("@mui/material/styles");

var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));

var _feedObject = require("../../types/feedObject");

var _material = require("@mui/material");

const _excluded = ["template"];

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

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; }

const PREFIX = 'SCFeedObjectSkeleton';
const classes = {
  root: `${PREFIX}-root`,
  media: `${PREFIX}-media`
};
const Root = (0, _styles.styled)(_Widget.default, {
  name: PREFIX,
  slot: 'Root',
  overridesResolver: (props, styles) => styles.root
})(({
  theme
}) => ({
  marginBottom: theme.spacing(2),
  [`& .${classes.media}`]: {
    height: 190
  }
}));

/**
 * > API documentation for the Community-UI Feed Object Skeleton component. Learn about the available props and the CSS API.

 #### Import

 ```jsx
 import {FeedObjectSkeleton} from '@selfcommunity/ui';
 ```

 #### Component Name

 The name `SCFeedObjectSkeleton` can be used when providing style overrides in the theme.

 #### CSS

 |Rule Name|Global class|Description|
 |---|---|---|
 |root|.SCFeedObjectSkeleton-root|Styles applied to the root element.|
 |media|.SCFeedObjectSkeleton-media|Styles applied to the media element.|
 *
 */
function FeedObjectSkeleton(props) {
  const {
    template
  } = props,
        rest = _objectWithoutPropertiesLoose(props, _excluded);

  const _template = template || _feedObject.SCFeedObjectTemplateType.SNIPPET;

  let obj;

  if (_template === _feedObject.SCFeedObjectTemplateType.PREVIEW || _template === _feedObject.SCFeedObjectTemplateType.DETAIL) {
    obj = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.CardHeader, {
      avatar: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        variant: "circular",
        width: 40,
        height: 40
      }),
      title: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        height: 10,
        width: "80%",
        style: {
          marginBottom: 6
        }
      }),
      subheader: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        height: 10,
        width: "40%"
      })
    }), /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
      animation: "wave",
      variant: "rectangular",
      className: classes.media
    }), /*#__PURE__*/_react.default.createElement(_material.CardContent, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
      animation: "wave",
      height: 10,
      style: {
        marginBottom: 6
      }
    }), /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
      animation: "wave",
      height: 10,
      width: "80%"
    }))));
  } else {
    obj = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.CardHeader, {
      avatar: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        variant: "circular",
        width: 40,
        height: 40
      }),
      title: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        height: 10,
        width: "80%",
        style: {
          marginBottom: 6
        }
      }),
      subheader: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
        animation: "wave",
        height: 10,
        width: "40%"
      })
    }), /*#__PURE__*/_react.default.createElement(_material.CardContent, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
      animation: "wave",
      height: 10,
      style: {
        marginBottom: 6
      }
    }), /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
      animation: "wave",
      height: 10,
      width: "80%"
    }))));
  }

  return /*#__PURE__*/_react.default.createElement(Root, _extends({
    className: classes.root
  }, rest), /*#__PURE__*/_react.default.createElement(_material.Box, {
    className: `${PREFIX}-${_template}`
  }, obj));
}