umwd-components 0.1.586 → 0.1.587
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/auth/AuthWidget.js +1 -1
- package/dist/src/components/e-commerce/cart/CartWidget.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/auth/AuthWidget.tsx +18 -13
- package/src/components/e-commerce/cart/CartWidget.tsx +6 -4
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import e from"react";import t from"@mui/material/SpeedDial";import
|
|
7
|
+
import e from"react";import t from"@mui/material/SpeedDial";import r from"@mui/material/SpeedDialAction";import i from"@mui/material/Box";import o from"@mui/material/Stack";import n from"@mui/material/CircularProgress";import m from"@mui/icons-material/AccountCircle";import a from"@mui/icons-material/Person";import l from"@mui/icons-material/Folder";import u from"@mui/icons-material/ListAlt";import c from"@mui/icons-material/Login";import s from"@mui/icons-material/Logout";import p from"@mui/icons-material/HowToReg";import{useRouter as d}from"next/navigation";import{useSession as g}from"../../context/auth/SessionContext.js";import f from"@mui/material/Button";import{Typography as x}from"@mui/material";var E={loggedIn:[{icon:e.createElement(a,null),name:"Profile",route:"/user/profile"},{icon:e.createElement(u,null),name:"Orders",route:"/user/orders"},{icon:e.createElement(l,null),name:"Documents",route:"/user/documents"}],loggedOut:[{icon:e.createElement(c,null),name:"Sign-In",route:"/auth/signin"},{icon:e.createElement(p,null),name:"Register",route:"/auth/register"}]};function h(a){var l=a.actions,u=void 0===l?E:l,c=d(),p=g(),h=p.user,w=p.loading,v=p.error,C=p.logout;return w?e.createElement(i,{sx:{position:"relative",width:"40px",height:"40px"}},e.createElement(n,null)):v?e.createElement("p",null,"Error: ",v):e.createElement(e.Fragment,null,e.createElement(o,{direction:"column",sx:{display:{xs:"flex",md:"none"},width:"100%"}},e.createElement(x,{variant:"h6",sx:{textAlign:"center"}},"Cart"),e.createElement(o,{spacing:1,direction:"row",sx:{width:"100%"}},(h?u.loggedIn:u.loggedOut).map((function(t){return e.createElement(f,{variant:"contained",startIcon:t.icon,onClick:function(){return c.push(t.route)}},t.name)})))),e.createElement(i,{sx:{display:{xs:"none",md:"block"},position:"relative",width:"40px",height:"40px"}},e.createElement(t,{ariaLabel:"SpeedDial basic example",icon:e.createElement(m,null),direction:"down",sx:{position:"absolute",top:0,right:0,width:40,"& .MuiFab-root":{width:40,height:40}}},(h?u.loggedIn:u.loggedOut).map((function(t){return e.createElement(r,{key:t.name,icon:t.icon,tooltipTitle:t.name,onClick:function(){return c.push(t.route)}})})),h&&e.createElement(r,{icon:e.createElement(s,null),tooltipTitle:"Log-Out",onClick:function(){return C()}}))))}export{h as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import o from"@mui/material/Box";import i from"@mui/material/Stack";import n from"@mui/material/Button";import l from"@mui/material/Badge";import m from"@mui/material/IconButton";import c from"@mui/material/CircularProgress";import p from"@mui/material/useMediaQuery";import{useTheme as s}from"@mui/material/styles";import u from"next/link";import x from"@mui/icons-material/ShoppingCart";import d from"./CartSummary.js";import f from"@mui/material/Typography";import{useClientSideCart as g}from"./hooks.js";import{Grow as h}from"@mui/material";function E(E){var v=E.data,k=v.cartUrl,b=void 0===k?"/shop/cart":k,y=v.checkoutUrl,C=void 0===y?"/shop/check-out":y,B=g(),w=B.state,S=B.isClient,j=t(a(null),2),z=j[0],T=j[1],M=function(e){T(e.currentTarget)},P=function(){T(null)},_=Boolean(z),A=_?"cart-widget-popover":void 0,O=s(),U=p(O.breakpoints.down("sm"));return S?r.createElement(r.Fragment,null,r.createElement(i,{direction:"column",sx:{display:{xs:"flex",md:"none"},width:"100%"}},r.createElement(f,{variant:"h6",sx:{textAlign:"center"}},"Profile"),r.createElement(d,null),r.createElement(i,{direction:"row",spacing:{xs:1}},r.createElement(u,{href:b,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"outlined",onClick:function(){P()}},r.createElement(x,null))),r.createElement(u,{href:C,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"contained",onClick:function(){P()}},"Check Out")))),r.createElement(o,{component:"div",sx:{display:{xs:"none",md:"block"},position:"relative",width:"40px",height:"40px",mr:"10px"},onMouseEnter:M,onMouseLeave:P},r.createElement(l,{badgeContent:w.totalAmount,color:"primary"},r.createElement(m,{"aria-describedby":A,onClick:function(e){z?P():M(e)},sx:{color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)","&:hover":{backgroundColor:"primary.dark"}}},r.createElement(x,{sx:{color:"primary.contrastText"}}))),r.createElement(h,e({in:_},_?{}:{timeout:1e3}),r.createElement(o,{id:A,sx:[{position:"absolute",top:"65px",right:0,backgroundColor:"background.paper",boxShadow:2,width:"max-content"}]},r.createElement(d,null),r.createElement(i,{spacing:{xs:1,sm:2},sx:{p:{xs:1,sm:2}}},r.createElement(u,{href:b,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"outlined",onClick:function(){P()}},r.createElement(x,null))),r.createElement(u,{href:C,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"contained",onClick:function(){P()}},"Check Out"))))))):r.createElement(c,null)}export{E as default};
|