"use strict";

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

exports.__esModule = true;
exports.DropdownItem = exports.MenuSectionList = void 0;

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

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

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

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

var _MenuItemList = require("../MenuItemList");

var _templateObject, _templateObject2, _templateObject3;

var MenuSectionList = function MenuSectionList(_ref) {
  var sections = _ref.sections,
      isActive = _ref.isActive;
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, sections == null ? void 0 : sections.map(function (section) {
    var _section$items;

    return /*#__PURE__*/_react["default"].createElement(Column, {
      key: section._id,
      className: "pt-3 px-2",
      isActive: isActive
    }, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
      key: 'DropdownItem-' + section.linkUrl
    }, /*#__PURE__*/_react["default"].createElement(_lib.Link, {
      href: section.linkUrl || '/',
      passHref: true
    }, /*#__PURE__*/_react["default"].createElement(DropdownItem, {
      isHeader: true
    }, section == null ? void 0 : section.name)), (_section$items = section.items) == null ? void 0 : _section$items.map(function (item) {
      var _item$data, _item$data2, _item$data3;

      return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
        key: item._id
      }, /*#__PURE__*/_react["default"].createElement(_MenuItemList.MenuItemList, {
        items: item == null ? void 0 : (_item$data = item.data) == null ? void 0 : _item$data.before
      }), /*#__PURE__*/_react["default"].createElement(_MenuItemList.MenuItemList, {
        items: item == null ? void 0 : (_item$data2 = item.data) == null ? void 0 : _item$data2.items
      }), /*#__PURE__*/_react["default"].createElement(_MenuItemList.MenuItemList, {
        items: item == null ? void 0 : (_item$data3 = item.data) == null ? void 0 : _item$data3.after
      }));
    })));
  }));
};

exports.MenuSectionList = MenuSectionList;

var Column = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  display: inline-block;\n  opacity: 0;\n  transform: translateY(-10px);\n  transition: transform 0.1s, opacity 0.1s;\n  transition-delay: 0s;\n  text-align: left;\n  line-height: 1.75;\n  width: 16.666666666666664%;\n  vertical-align: top;\n\n  ", "\n"])), function (props) {
  return props.isActive && (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])(["\n      opacity: 1;\n      transform: translateY(0);\n      transition: transform 0.3s ease, opacity 0.2s linear;\n      transition-delay: 0.2s;\n    "])));
});

var DropdownItem = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2["default"])(["\n  font-size: 1.4rem;\n  line-height: 1.428571;\n  cursor: pointer;\n  color: ", ";\n  font-weight: 500;\n  margin-bottom: 6px;\n  text-align: left;\n  display: block;\n  text-decoration: none;\n\n  &.promotion,\n  &.red {\n    color: ", " !important;\n    opacity: 1 !important;\n  }\n\n  &.bold {\n    font-weight: bold;\n  }\n\n  ", "\n\n  ", "\n"])), function (_ref2) {
  var theme = _ref2.theme;
  return theme.palette.hint;
}, function (_ref3) {
  var theme = _ref3.theme;
  return theme.palette.discount;
}, function (props) {
  return !props.isHeader && "\n  :hover {\n    color: " + props.theme.palette.primary + ";\n    transition: color .2s;\n  }\n  ";
}, function (props) {
  return props.isHeader && "\n      margin-top: 14px;\n      margin-bottom: 14px;\n      color: " + props.theme.palette.primary + ";\n      font-size: 1.6rem;\n  ";
});

exports.DropdownItem = DropdownItem;
//# sourceMappingURL=index.js.map