@shopgate/engage
Version:
Shopgate's ENGAGE library.
4 lines • 2.15 kB
JavaScript
import React,{Fragment}from'react';import{FAVORITES_PATH}from'@shopgate/pwa-common-commerce/favorites/constants';import{CART_PATH}from'@shopgate/pwa-common-commerce/cart/constants';import{LOGIN_PATH}from'@shopgate/pwa-common/constants/RoutePaths';import appConfig from'@shopgate/pwa-common/helpers/config';import{useSideNavigation}from"./SideNavigation.hooks";import SideNavigationItem from"./SideNavigationItem";import SideNavigationNestedItem from"./SideNavigationNestedItem";import SideNavigationLinksQuicklinks from"./SideNavigationLinksQuicklinks";import SideNavigationLinksLegal from"./SideNavigationLinksLegal";import{PROFILE_PATH,WISH_LIST_PATH,ORDERS_PATH}from"../../account";/**
* SideNavigationLinks component
* @returns {JSX}
*/var SideNavigationLinks=function SideNavigationLinks(){var _useSideNavigation=useSideNavigation(),isLoggedIn=_useSideNavigation.isLoggedIn,logout=_useSideNavigation.logout,currentPathname=_useSideNavigation.currentPathname;var isAccountActive=currentPathname===PROFILE_PATH||currentPathname===ORDERS_PATH||currentPathname===WISH_LIST_PATH;return React.createElement(Fragment,null,React.createElement(SideNavigationItem,{href:CART_PATH,label:"navigation.cart"}),!isLoggedIn&&appConfig.hasFavorites?React.createElement(SideNavigationItem,{href:FAVORITES_PATH,label:"navigation.favorites"}):null,isLoggedIn&&React.createElement(SideNavigationNestedItem,{href:PROFILE_PATH,label:"navigation.your_account",forceActive:isAccountActive,level:0},React.createElement("ul",null,React.createElement(SideNavigationItem,{level:1,href:PROFILE_PATH,label:"titles.profile"}),React.createElement(SideNavigationItem,{level:1,href:ORDERS_PATH,label:"titles.order_history"}),appConfig.hasFavorites?React.createElement(SideNavigationItem,{level:1,href:WISH_LIST_PATH,label:"titles.favorites"}):null)),React.createElement(SideNavigationLinksQuicklinks,null),React.createElement(SideNavigationLinksLegal,null),isLoggedIn?React.createElement(SideNavigationItem,{onClick:logout,label:"navigation.logout"}):React.createElement(SideNavigationItem,{href:LOGIN_PATH,label:"navigation.login_register"}));};export default SideNavigationLinks;