"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.ProductInfo = void 0;

var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));

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

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _lib = require("@sentecacommerce-theme/lib");

var _Typography = require("../../../Common/Typography");

var _Price = require("../Price");

var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;

var ProductInfo = function ProductInfo(_ref) {
  var _ref$mobile = _ref.mobile,
      mobile = _ref$mobile === void 0 ? false : _ref$mobile;

  var _useProductState = (0, _lib.useProductState)(),
      metaData = _useProductState.metaData;

  var hasBrand = Boolean(metaData.brand.slug && metaData.brand.name);
  return /*#__PURE__*/_react["default"].createElement(Container, {
    mobile: mobile
  }, /*#__PURE__*/_react["default"].createElement(Flex, null, /*#__PURE__*/_react["default"].createElement(Left, null, /*#__PURE__*/_react["default"].createElement(InfoContainer, null, /*#__PURE__*/_react["default"].createElement(ProductName, null, metaData.name))), hasBrand && /*#__PURE__*/_react["default"].createElement(Right, null, /*#__PURE__*/_react["default"].createElement(_lib.Link, {
    href: "/" + metaData.brand.slug + "/b"
  }, /*#__PURE__*/_react["default"].createElement("a", {
    "aria-label": metaData.brand.name
  }, /*#__PURE__*/_react["default"].createElement(BrandLogo, {
    src: metaData.brand.logo
  }))))), /*#__PURE__*/_react["default"].createElement(PriceContainer, null, /*#__PURE__*/_react["default"].createElement(_Price.Price, null)));
};

exports.ProductInfo = ProductInfo;

var Container = _styledComponents["default"].div.attrs(function (props) {
  return {
    className: props.mobile ? 'd-flex d-lg-none' : 'd-none d-lg-flex'
  };
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  justify-content: space-between;\n  align-items: flex-start;\n  flex-direction: column;\n"])));

var BrandLogo = _styledComponents["default"].img(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  max-width: 10rem;\n  @media (min-width: ", ") {\n    max-width: 7.5rem;\n  }\n"])), function (_ref2) {
  var theme = _ref2.theme;
  return theme.breakpoints.md.min;
});

var ProductName = (0, _styledComponents["default"])(_Typography.Typography).attrs({
  as: 'h2',
  variant: '4',
  className: 'mb-1'
})(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var Flex = _styledComponents["default"].div.attrs({
  className: 'd-flex'
})(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  width: 100%;\n"])));

var Right = _styledComponents["default"].div.attrs({
  className: 'ml-auto'
})(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var Left = _styledComponents["default"].div.attrs({
  className: 'pr-3'
})(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var InfoContainer = _styledComponents["default"].div.attrs({
  className: ''
})(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var PriceContainer = _styledComponents["default"].div.attrs({
  className: 'pt-2'
})(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteralLoose2["default"])([""])));
//# sourceMappingURL=index.js.map