import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/taggedTemplateLiteralLoose";

var _templateObject, _templateObject2;

import React, { useState } from 'react';
import styled from 'styled-components';
import { useProductState, useUIFunctions, useConfigState, useLocalLabels } from '@sentecacommerce-theme/lib';
import { AvailabilityPerStore } from '../AvailabilityPerStore';
export var ProductContent = (_ref) => {
  var _metaData$content$len, _metaData$content;

  var {
    renderVariantSelector,
    isSizeSelected,
    handleClickDescription
  } = _ref;
  var [storesModalOpen, setStoresModalOpen] = useState(false);
  var {
    metaData,
    selectedVariant
  } = useProductState();
  var {
    enqueueView
  } = useUIFunctions();
  var {
    views
  } = useConfigState();

  var handleStoresModalOpen = () => setStoresModalOpen(true);

  var handleStoresModalClose = () => setStoresModalOpen(false);

  var hasDescription = ((_metaData$content$len = metaData == null ? void 0 : (_metaData$content = metaData.content) == null ? void 0 : _metaData$content.length) != null ? _metaData$content$len : 0) > 0;
  var labels = useLocalLabels();
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ShortDescription, null, metaData.shortDescription), hasDescription && /*#__PURE__*/React.createElement(ViewMoreDetails // onClick={() =>
  //   enqueueView<ItemDescriptionProps>(views.itemDesc, {
  //     content: metaData.content,
  //     title: metaData.name,
  //   })
  // }
  , {
    onClick: handleClickDescription
  }, labels.vieProductDetails), /*#__PURE__*/React.createElement(ViewMoreDetails, {
    onClick: handleStoresModalOpen,
    withTopMargin: true
  }, labels.checkAvailablity), storesModalOpen && /*#__PURE__*/React.createElement(AvailabilityPerStore, {
    isSizeSelected: isSizeSelected,
    renderVariantSelector: renderVariantSelector,
    onClose: handleStoresModalClose
  }));
};
var ShortDescription = styled.p.attrs({
  className: 'pt-2 pb-2'
})(_templateObject || (_templateObject = _taggedTemplateLiteralLoose([""])));
var ViewMoreDetails = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n  box-shadow: inset 0 -1px 0 0 ", ";\n  cursor: pointer;\n  width: fit-content;\n  margin-top: ", ";\n\n  &:hover {\n    opacity: 0.7;\n  }\n"])), (_ref2) => {
  var {
    theme
  } = _ref2;
  return theme.palette.primary;
}, props => props.withTopMargin ? '1.2rem' : 0);
export default ProductContent;
//# sourceMappingURL=index.js.map