umwd-components 0.1.744 → 0.1.745
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.
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Box"),
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Box"),t=require("@mui/material/Stack"),a=require("@mui/material/Button"),s=require("@mui/material/Badge"),n=require("@mui/material/IconButton"),o=require("@mui/material/CircularProgress"),l=require("@mui/material/useMediaQuery"),x=require("@mui/material/styles"),c=require("next/link"),u=require("@mui/icons-material/ShoppingCart"),d=require("./CartSummary.js"),m=require("@mui/material/Typography"),p=require("./hooks.js"),h=require("@mui/material");exports.default=function({data:j}){const{cartUrl:g="/shop/cart",checkoutUrl:k="/shop/check-out"}=j,{state:C,isClient:q}=p.useClientSideCart(),[b,y]=r.useState(null),v=e=>{y(e.currentTarget)},f=()=>{y(null)},w=Boolean(b),S=w?"cart-widget-popover":void 0,B=x.useTheme(),T=l(B.breakpoints.down("sm"));return q?e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"column",spacing:2,sx:{display:{xs:"flex",md:"none"},width:"100%"},children:[e.jsx(m,{variant:"h6",sx:{textAlign:"center"},children:"Cart"}),e.jsx(d.default,{}),e.jsxs(t,{direction:"row",spacing:1,sx:{width:"100%"},justifyContent:"flex-end",children:[e.jsx(c,{href:g,children:e.jsx(a,{size:T?"small":"large",variant:"outlined",onClick:()=>{f()},children:e.jsx(u,{})})}),e.jsx(c,{href:k,children:e.jsx(a,{size:T?"small":"large",variant:"contained",onClick:()=>{f()},children:"Check Out"})})]})]}),e.jsxs(i,{component:"div",sx:{display:{xs:"none",md:"block"},position:"relative",width:"40px",height:"40px",mr:"10px"},onMouseEnter:v,onMouseLeave:f,children:[e.jsx(s,{badgeContent:C.totalAmount,color:"primary",children:e.jsx(n,{"aria-describedby":S,onClick:e=>{b?f():v(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"}},children:e.jsx(u,{sx:{color:"primary.contrastText"}})})}),e.jsx(h.Grow,{in:w,...w?{}:{timeout:1e3},children:e.jsxs(i,{id:S,sx:[{position:"absolute",top:"65px",right:0,backgroundColor:"background.paper",boxShadow:2,width:"max-content"}],children:[e.jsx(d.default,{}),e.jsxs(t,{spacing:{xs:1,sm:2},sx:{p:{xs:1,sm:2}},children:[e.jsx(c,{href:g,children:e.jsx(a,{size:T?"small":"large",variant:"outlined",onClick:()=>{f()},children:e.jsx(u,{})})}),e.jsx(c,{href:k,children:e.jsx(a,{size:T?"small":"large",variant:"contained",onClick:()=>{f()},children:"Check Out"})})]})]})})]})]}):e.jsx(o,{})};
|