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

var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;

import React from 'react';
import styled from 'styled-components';
import { useRouter } from 'next/router';
import { useLogout } from '@sentecacommerce-theme/lib';
import { useProfileDispatch } from '../../../profile.context';
export var NavigationItem = (_ref) => {
  var {
    label,
    url
  } = _ref;
  var router = useRouter();
  var dispatch = useProfileDispatch();
  var logout = useLogout();

  var handleClick = e => {
    if (url === 'logout') {
      e.preventDefault();
      logout();
      return router.push('/');
    }

    dispatch({
      type: 'change',
      payload: url.replace('#', '')
    });
  };

  return /*#__PURE__*/React.createElement(Container, {
    onClick: handleClick
  }, /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(Inner, null, label), /*#__PURE__*/React.createElement(MobileArrow, null, /*#__PURE__*/React.createElement(ButtonSvg, {
    viewBox: "0 0 238.003 238.003"
  }, /*#__PURE__*/React.createElement("path", {
    d: "M181.776 107.719L78.705 4.648c-6.198-6.198-16.273-6.198-22.47 0s-6.198 16.273 0 22.47l91.883 91.883-91.883 91.883c-6.198 6.198-6.198 16.273 0 22.47s16.273 6.198 22.47 0l103.071-103.039a15.741 15.741 0 0 0 4.64-11.283c0-4.13-1.526-8.199-4.64-11.313z"
  })))));
};
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n  box-shadow: inset 0 -1px 0 0 ", ";\n"])), (_ref2) => {
  var {
    theme
  } = _ref2;
  return theme.palette.light;
});
var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n  align-items: center;\n  display: flex;\n  cursor: pointer;\n  height: 44px;\n  position: relative;\n"])));
var Inner = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n  width: calc(100% - 32px);\n  line-height: 44px;\n  display: inline-block;\n\n  &:hover {\n    opacity: 0.5;\n  }\n"])));
var MobileArrow = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n  position: absolute;\n  top: 15px;\n  right: 0;\n  text-align: center;\n"])));
var ButtonSvg = styled.svg(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n  width: 1.3rem;\n  height: 1.3rem;\n  display: block;\n\n  @media only screen and (min-width: ", ") {\n    display: none;\n  }\n"])), (_ref3) => {
  var {
    theme
  } = _ref3;
  return theme.breakpoints.lg.min;
});
//# sourceMappingURL=index.js.map