@shopgate/engage
Version:
Shopgate's ENGAGE library.
4 lines • 2.23 kB
JavaScript
import React from'react';import PropTypes from'prop-types';import{hot}from'react-hot-loader/root';import I18n from'@shopgate/pwa-common/components/I18n';import appConfig from'@shopgate/pwa-common/helpers/config';import{i18n,useRoute}from'@shopgate/engage/core';import OrderHistory from"../../../orders/components/OrderHistory";import OrderHistoryProvider from"../../../orders/providers/OrderHistoryProvider";import{Tabs,Tab,TabPanel}from"../../../components/Tabs";import{tabs,title,tabPanel}from"./Account.style";import{ResponsiveContainer}from"../../../components";import Lists from"../../../favorites/components/Lists";import connect from"./Account.connector";import{TabContext}from"../../../components/Tabs/TabContext";import Profile from"../Profile";/**
* The Tabs components
* @returns {JSX}
*/var Account=function Account(_ref){var historyReplace=_ref.historyReplace;var _useRoute=useRoute(),_useRoute$params$tab=_useRoute.params.tab,tab=_useRoute$params$tab===void 0?'profile':_useRoute$params$tab;return React.createElement(React.Fragment,null,React.createElement(TabContext,{value:tab},React.createElement("div",{className:tabs},React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement("div",{className:title},React.createElement(I18n.Text,{string:"titles.your_account"}))),React.createElement(Tabs,{indicatorColor:"primary",textColor:"primary",onChange:function onChange(event,newValue){return historyReplace({pathname:"/account/".concat(newValue)});},"aria-label":"disabled tabs example"},React.createElement(Tab,{value:"profile",label:i18n.text('titles.profile')}),React.createElement(Tab,{value:"orders",label:i18n.text('titles.order_history')}),appConfig.hasFavorites?React.createElement(Tab,{value:"wish-list",label:i18n.text('titles.favorites')}):null)),React.createElement(TabPanel,{className:tabPanel,value:"profile"},React.createElement(Profile,null)),React.createElement(TabPanel,{className:tabPanel,value:"orders"},React.createElement(OrderHistoryProvider,null,React.createElement(OrderHistory,null))),appConfig.hasFavorites?React.createElement(TabPanel,{className:tabPanel,value:"wish-list"},React.createElement(Lists,null)):null));};export default hot(connect(Account));