umwd-components 0.1.7 → 0.1.8
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/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/NavBar/NavBar.js +218 -0
- package/src/components/NavBar/index.js +1 -568
package/dist/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as
|
|
1
|
+
import e,{useState as t,useEffect as a,useCallback as r}from"react";import{TextField as n,AppBar as l,Container as c,Toolbar as o,Box as i,Typography as s,Button as m,Dialog as p,List as x,ListItem as d,ListItemText as h,Divider as f}from"@mui/material";import u from"prop-types";import g from"next/link";import y from"@mui/icons-material/Close";import k from"@mui/icons-material/MoreVert";!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}");const E=()=>e.createElement("svg",{x:"0px",y:"0px",width:"15px",height:"15px",viewBox:"0 0 122.879 122.879",enableBackground:"new 0 0 122.879 122.879"},e.createElement("g",null,e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FF4141",d:"M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"}))),b=()=>e.createElement("svg",{className:"checkmark",viewBox:"0 0 52 52"},e.createElement("circle",{className:"checkmark__circle",cx:"26",cy:"26",r:"25",fill:"none"}),e.createElement("path",{className:"checkmark__check",fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8"})),R=({value:r,requirement:n})=>{const[l,c]=t();return a((()=>{c(n.validator(r))}),[r,n]),e.createElement("div",{className:"requirement"},l?e.createElement(b,null):e.createElement(E,null),e.createElement("p",{className:l?"valid":"invalid"},n.text))},w=({value:t,requirements:n,onValidChange:l})=>{const c=r(l,[]);return a((()=>{c(n.every((e=>e.validator(t))))}),[t,n,c]),n.map(((a,r)=>e.createElement(R,{key:r,value:t,requirement:a,onValidChange:l})))};function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},v.apply(this,arguments)}const C=t=>e.createElement(n,v({},t,{sx:{background:"linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"}}));function W({label:t,backgroundColor:a="red",size:r="md",onClick:n}){let l=1;"sm"===r&&(l=.75),"lg"===r&&(l=1.25);const c={backgroundColor:a,padding:`${.5*l}rem ${1*l}rem`,border:"none"};return e.createElement("button",{style:c,onClick:n},t)}function T({children:t,spacing:a=2,direction:r="row",wrap:n=!1}){const l={display:"flex",gap:.25*a+"rem",flexWrap:n?"wrap":"nowrap",flexDirection:r};return e.createElement("div",{style:l},t)}W.propTypes={label:u.string,backgroundColor:u.string,size:u.oneOf(["sm","md","lg"]),onClick:u.func},T.propTypes={spacing:u.number,wrap:u.bool,direction:u.oneOf(["row","column"])};const _=({site_title:e,logo:a,pages:r})=>{const[n,u]=t(!1),E=e=>{u(!1)};return React.createElement(l,{position:"sticky"},React.createElement(c,{maxWidth:"xl"},React.createElement(o,{disableGutters:!0,sx:{py:1}},React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",alignItems:"center"}},React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,width:a.width||"32px",height:a.height||"32px",alt:"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==e&&React.createElement(s,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none"}},e))),React.createElement(i,{sx:{flexGrow:1,display:{xs:"none",md:"flex"},alignItems:"center"}},r.map((e=>React.createElement(m,{key:e.name,onClick:()=>e.action(),sx:{my:2,color:"primary.contrastText",display:"block"}},e.name)))),React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==a.url&&React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,width:a.width||"32px",height:a.height||"32px",alt:a.alt||"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==e&&React.createElement(s,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},e))),React.createElement(i,{sx:{display:{xs:"flex",md:"none"},flexGrow:1}}),React.createElement(i,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},React.createElement(m,{onClick:e=>{u(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"}},React.createElement(k,{sx:{color:"primary.contrastText"}})),React.createElement(p,{fullScreen:!0,open:n,onClose:E},React.createElement(l,{position:"sticky"},React.createElement(c,{maxWidth:"xl"},React.createElement(o,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,alt:a.alt||"logo",width:a.width||"32px",height:a.height||"32px",style:{maxWidth:"60px",maxHeight:"60px"}})),React.createElement(s,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},void 0!==e&&e))),React.createElement(m,{onClick:E,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},"aria-label":"close"},React.createElement(y,{sx:{color:"primary.contrastText"}}))))),React.createElement(x,null,r.map((e=>React.createElement(React.Fragment,null,React.createElement(d,{key:e.name,onClick:()=>{e.action(),E()}},React.createElement(h,{primary:e.name})),React.createElement(f,null))))))))))};export{W as Button,_ as NavBar,C as NoteTextField,w as Requirements,T as Stack};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),
|
|
1
|
+
"use strict";var e=require("react"),t=require("@mui/material"),a=require("prop-types"),r=require("next/link"),n=require("@mui/icons-material/Close"),l=require("@mui/icons-material/MoreVert");!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}");const o=()=>e.createElement("svg",{x:"0px",y:"0px",width:"15px",height:"15px",viewBox:"0 0 122.879 122.879",enableBackground:"new 0 0 122.879 122.879"},e.createElement("g",null,e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FF4141",d:"M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"}))),c=()=>e.createElement("svg",{className:"checkmark",viewBox:"0 0 52 52"},e.createElement("circle",{className:"checkmark__circle",cx:"26",cy:"26",r:"25",fill:"none"}),e.createElement("path",{className:"checkmark__check",fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8"})),i=({value:t,requirement:a})=>{const[r,n]=e.useState();return e.useEffect((()=>{n(a.validator(t))}),[t,a]),e.createElement("div",{className:"requirement"},r?e.createElement(c,null):e.createElement(o,null),e.createElement("p",{className:r?"valid":"invalid"},a.text))};function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},s.apply(this,arguments)}function m({label:t,backgroundColor:a="red",size:r="md",onClick:n}){let l=1;"sm"===r&&(l=.75),"lg"===r&&(l=1.25);const o={backgroundColor:a,padding:`${.5*l}rem ${1*l}rem`,border:"none"};return e.createElement("button",{style:o,onClick:n},t)}function x({children:t,spacing:a=2,direction:r="row",wrap:n=!1}){const l={display:"flex",gap:.25*a+"rem",flexWrap:n?"wrap":"nowrap",flexDirection:r};return e.createElement("div",{style:l},t)}m.propTypes={label:a.string,backgroundColor:a.string,size:a.oneOf(["sm","md","lg"]),onClick:a.func},x.propTypes={spacing:a.number,wrap:a.bool,direction:a.oneOf(["row","column"])};exports.Button=m,exports.NavBar=({site_title:a,logo:o,pages:c})=>{const[i,s]=e.useState(!1),m=e=>{s(!1)};return React.createElement(t.AppBar,{position:"sticky"},React.createElement(t.Container,{maxWidth:"xl"},React.createElement(t.Toolbar,{disableGutters:!0,sx:{py:1}},React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",alignItems:"center"}},React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,width:o.width||"32px",height:o.height||"32px",alt:"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==a&&React.createElement(t.Typography,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none"}},a))),React.createElement(t.Box,{sx:{flexGrow:1,display:{xs:"none",md:"flex"},alignItems:"center"}},c.map((e=>React.createElement(t.Button,{key:e.name,onClick:()=>e.action(),sx:{my:2,color:"primary.contrastText",display:"block"}},e.name)))),React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==o.url&&React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,width:o.width||"32px",height:o.height||"32px",alt:o.alt||"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==a&&React.createElement(t.Typography,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},a))),React.createElement(t.Box,{sx:{display:{xs:"flex",md:"none"},flexGrow:1}}),React.createElement(t.Box,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},React.createElement(t.Button,{onClick:e=>{s(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"}},React.createElement(l,{sx:{color:"primary.contrastText"}})),React.createElement(t.Dialog,{fullScreen:!0,open:i,onClose:m},React.createElement(t.AppBar,{position:"sticky"},React.createElement(t.Container,{maxWidth:"xl"},React.createElement(t.Toolbar,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,alt:o.alt||"logo",width:o.width||"32px",height:o.height||"32px",style:{maxWidth:"60px",maxHeight:"60px"}})),React.createElement(t.Typography,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},void 0!==a&&a))),React.createElement(t.Button,{onClick:m,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},"aria-label":"close"},React.createElement(n,{sx:{color:"primary.contrastText"}}))))),React.createElement(t.List,null,c.map((e=>React.createElement(React.Fragment,null,React.createElement(t.ListItem,{key:e.name,onClick:()=>{e.action(),m()}},React.createElement(t.ListItemText,{primary:e.name})),React.createElement(t.Divider,null))))))))))},exports.NoteTextField=a=>e.createElement(t.TextField,s({},a,{sx:{background:"linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"}})),exports.Requirements=({value:t,requirements:a,onValidChange:r})=>{const n=e.useCallback(r,[]);return e.useEffect((()=>{n(a.every((e=>e.validator(t))))}),[t,a,n]),a.map(((a,n)=>e.createElement(i,{key:n,value:t,requirement:a,onValidChange:r})))},exports.Stack=x;
|
package/package.json
CHANGED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
AppBar,
|
|
7
|
+
Box,
|
|
8
|
+
Toolbar,
|
|
9
|
+
Typography,
|
|
10
|
+
Container,
|
|
11
|
+
Button,
|
|
12
|
+
List,
|
|
13
|
+
ListItem,
|
|
14
|
+
Divider,
|
|
15
|
+
ListItemText
|
|
16
|
+
} from "@mui/material";
|
|
17
|
+
|
|
18
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
19
|
+
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
20
|
+
|
|
21
|
+
export const NavBar = ({site_title, logo, pages}) => {
|
|
22
|
+
// handleMobileMenu
|
|
23
|
+
|
|
24
|
+
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
|
25
|
+
|
|
26
|
+
const handleOpenMobileMenu = (e) => {
|
|
27
|
+
setMobileNavOpen(true);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleCloseMobileMenu = (e) => {
|
|
31
|
+
setMobileNavOpen(false);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<AppBar position="sticky">
|
|
38
|
+
<Container maxWidth="xl">
|
|
39
|
+
<Toolbar disableGutters sx={{py:1}}>
|
|
40
|
+
{/* logo and site title for big screens */}
|
|
41
|
+
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
42
|
+
<Box
|
|
43
|
+
sx={{ display: { xs: "none", md: "flex" }, cursor: "pointer", alignItems: "center"}}
|
|
44
|
+
><Box sx={{ display: "flex", mr: 1 }}>
|
|
45
|
+
<img
|
|
46
|
+
src={logo.url}
|
|
47
|
+
width={logo.width || "32px"}
|
|
48
|
+
height={logo.height || "32px"}
|
|
49
|
+
alt="site logo"
|
|
50
|
+
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
51
|
+
/>
|
|
52
|
+
</Box>
|
|
53
|
+
{site_title !== undefined && (
|
|
54
|
+
<Typography
|
|
55
|
+
|
|
56
|
+
variant="h6"
|
|
57
|
+
noWrap
|
|
58
|
+
component="h1"
|
|
59
|
+
sx={{
|
|
60
|
+
display: "flex",
|
|
61
|
+
textDecoration: "none",
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{site_title}
|
|
65
|
+
</Typography>
|
|
66
|
+
)}
|
|
67
|
+
</Box>
|
|
68
|
+
</Link>
|
|
69
|
+
|
|
70
|
+
{/* Large screen menu */}
|
|
71
|
+
<Box
|
|
72
|
+
sx={{
|
|
73
|
+
flexGrow: 1,
|
|
74
|
+
display: { xs: "none", md: "flex" },
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
{pages.map((page) => {
|
|
81
|
+
return (
|
|
82
|
+
<Button
|
|
83
|
+
key={page.name}
|
|
84
|
+
onClick={() => page.action()}
|
|
85
|
+
sx={{ my: 2, color: "primary.contrastText", display: "block" }}
|
|
86
|
+
>
|
|
87
|
+
{page.name}
|
|
88
|
+
</Button>
|
|
89
|
+
)})}
|
|
90
|
+
|
|
91
|
+
</Box>
|
|
92
|
+
|
|
93
|
+
{/* small screen logo and site title */}
|
|
94
|
+
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
95
|
+
<Box sx={{ display: { xs: "flex", md: "none" }, alignItems:"center"}}>
|
|
96
|
+
|
|
97
|
+
{logo.url !== undefined && <Box sx={{ display: "flex", mr: 1 }}>
|
|
98
|
+
<img
|
|
99
|
+
src={logo.url}
|
|
100
|
+
width={logo.width || "32px"}
|
|
101
|
+
height={logo.height || "32px"}
|
|
102
|
+
alt={logo.alt || "site logo"}
|
|
103
|
+
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
104
|
+
/>
|
|
105
|
+
</Box>}
|
|
106
|
+
{site_title !== undefined && <Typography
|
|
107
|
+
variant="h5"
|
|
108
|
+
noWrap
|
|
109
|
+
component="h1"
|
|
110
|
+
sx={{
|
|
111
|
+
display: "flex",
|
|
112
|
+
flexGrow: 1,
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{site_title}
|
|
116
|
+
</Typography>}
|
|
117
|
+
</Box>
|
|
118
|
+
</Link>
|
|
119
|
+
{/* spacer box */}
|
|
120
|
+
<Box sx={{ display: { xs: "flex", md: "none" }, flexGrow: 1 }}></Box>
|
|
121
|
+
|
|
122
|
+
{/* small screen nav menu */}
|
|
123
|
+
|
|
124
|
+
<Box sx={{ flexGrow: 0, display: { xs: "flex", md: "none" } }}>
|
|
125
|
+
<Button
|
|
126
|
+
onClick={handleOpenMobileMenu}
|
|
127
|
+
sx={{
|
|
128
|
+
width: "40px",
|
|
129
|
+
height: "40px",
|
|
130
|
+
borderRadius: "50%",
|
|
131
|
+
p: 0,
|
|
132
|
+
minWidth: "unset",
|
|
133
|
+
color: "primary.contrastText",
|
|
134
|
+
boxShadow:
|
|
135
|
+
"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)",
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
<MoreVertIcon sx={{ color: "primary.contrastText" }} />
|
|
139
|
+
</Button>
|
|
140
|
+
|
|
141
|
+
<Dialog
|
|
142
|
+
fullScreen
|
|
143
|
+
open={mobileNavOpen}
|
|
144
|
+
onClose={handleCloseMobileMenu}
|
|
145
|
+
>
|
|
146
|
+
<AppBar position="sticky">
|
|
147
|
+
<Container maxWidth="xl">
|
|
148
|
+
<Toolbar disableGutters sx={{py:1, justifyContent:"space-between"}}>
|
|
149
|
+
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
150
|
+
<Box sx={{display: "flex", flexDirection: "row", alignItems: "center"}}>
|
|
151
|
+
<Box sx={{ display: "flex", mr: 1 }}>
|
|
152
|
+
<img
|
|
153
|
+
src={logo.url}
|
|
154
|
+
alt={logo.alt || "logo"}
|
|
155
|
+
width={logo.width || "32px"}
|
|
156
|
+
height={logo.height || "32px"}
|
|
157
|
+
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
158
|
+
/>
|
|
159
|
+
</Box>
|
|
160
|
+
<Typography
|
|
161
|
+
variant="h5"
|
|
162
|
+
noWrap
|
|
163
|
+
component="h1"
|
|
164
|
+
sx={{
|
|
165
|
+
display: "flex",
|
|
166
|
+
flexGrow: 1,
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
|
|
170
|
+
{site_title !== undefined && site_title}
|
|
171
|
+
|
|
172
|
+
</Typography>
|
|
173
|
+
</Box>
|
|
174
|
+
</Link>
|
|
175
|
+
<Button
|
|
176
|
+
onClick={handleCloseMobileMenu}
|
|
177
|
+
sx={{
|
|
178
|
+
width: "40px",
|
|
179
|
+
height: "40px",
|
|
180
|
+
borderRadius: "50%",
|
|
181
|
+
p: 0,
|
|
182
|
+
minWidth: "unset",
|
|
183
|
+
color: "primary.contrastText",
|
|
184
|
+
boxShadow:
|
|
185
|
+
"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)",
|
|
186
|
+
}}
|
|
187
|
+
aria-label="close"
|
|
188
|
+
>
|
|
189
|
+
<CloseIcon sx={{ color: "primary.contrastText" }} />
|
|
190
|
+
</Button>
|
|
191
|
+
</Toolbar>
|
|
192
|
+
</Container>
|
|
193
|
+
</AppBar>
|
|
194
|
+
<List>
|
|
195
|
+
{pages.map((page) =>
|
|
196
|
+
{
|
|
197
|
+
return (
|
|
198
|
+
<>
|
|
199
|
+
<ListItem
|
|
200
|
+
key={page.name}
|
|
201
|
+
onClick={() => {page.action(); handleCloseMobileMenu();}}
|
|
202
|
+
>
|
|
203
|
+
<ListItemText primary={page.name} />
|
|
204
|
+
</ListItem>
|
|
205
|
+
<Divider />
|
|
206
|
+
</>
|
|
207
|
+
)})}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
</List>
|
|
212
|
+
</Dialog>
|
|
213
|
+
</Box>
|
|
214
|
+
</Toolbar>
|
|
215
|
+
</Container>
|
|
216
|
+
</AppBar>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
@@ -1,568 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import { useRouter } from "next/router";
|
|
4
|
-
import Link from "next/link";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
Dialog,
|
|
8
|
-
AppBar,
|
|
9
|
-
Box,
|
|
10
|
-
Toolbar,
|
|
11
|
-
Typography,
|
|
12
|
-
Container,
|
|
13
|
-
Button,
|
|
14
|
-
List,
|
|
15
|
-
ListItem,
|
|
16
|
-
Divider,
|
|
17
|
-
ListItemText,
|
|
18
|
-
Stack
|
|
19
|
-
} from "@mui/material";
|
|
20
|
-
|
|
21
|
-
import CloseIcon from "@mui/icons-material/Close";
|
|
22
|
-
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
TODO:
|
|
26
|
-
|
|
27
|
-
might have to become a different component, or there should be some way to handle submenus
|
|
28
|
-
|
|
29
|
-
const StyledShopMenuSpeedDial = styled(SpeedDial)(({ theme }) => ({
|
|
30
|
-
position: "relative",
|
|
31
|
-
width: "67px",
|
|
32
|
-
alignItems: "flex-start",
|
|
33
|
-
"& .MuiFab-root": {
|
|
34
|
-
height: 40,
|
|
35
|
-
borderRadius: "4px",
|
|
36
|
-
marginLeft: "10px",
|
|
37
|
-
boxShadow: "unset",
|
|
38
|
-
},
|
|
39
|
-
"& .MuiSpeedDial-actions": {
|
|
40
|
-
"& .MuiSpeedDialAction-fab": {
|
|
41
|
-
padding: "10px",
|
|
42
|
-
borderRadius: "4px",
|
|
43
|
-
width: "max-content",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})); */
|
|
47
|
-
|
|
48
|
-
function NavBar({site_title, logo, pages}) {
|
|
49
|
-
/*
|
|
50
|
-
To do:
|
|
51
|
-
Remove and find a better solution for cookie consent, also make sure it is in the right component
|
|
52
|
-
const { cookieConsent, handleDetailsOpen } = useContext(CookieConsentContext); */
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
TODO: i dont want to use this here directly
|
|
56
|
-
const { data: session } = useSession(); */
|
|
57
|
-
|
|
58
|
-
// use new appRouter
|
|
59
|
-
// const router = useRouter();
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
Move to a different component
|
|
63
|
-
const auth = true; */
|
|
64
|
-
|
|
65
|
-
/*
|
|
66
|
-
TODO: use submenus instead
|
|
67
|
-
const blogging = false;
|
|
68
|
-
const commerce = true; */
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
TODO should be a prop
|
|
72
|
-
const pages = [
|
|
73
|
-
{
|
|
74
|
-
name: "Resources",
|
|
75
|
-
link: "/resources",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "Contact",
|
|
79
|
-
link: "/contact",
|
|
80
|
-
},
|
|
81
|
-
]; */
|
|
82
|
-
|
|
83
|
-
// push modules
|
|
84
|
-
/*
|
|
85
|
-
TODO a better way to handle this
|
|
86
|
-
if (blogging) {
|
|
87
|
-
pages.splice(0, 0, {
|
|
88
|
-
name: "Blog",
|
|
89
|
-
action: () => {
|
|
90
|
-
router.push("/blog");
|
|
91
|
-
handleCloseNavMenu();
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
} */
|
|
95
|
-
|
|
96
|
-
/*
|
|
97
|
-
TODO:
|
|
98
|
-
move to a component better suited to handle this
|
|
99
|
-
const actions = {
|
|
100
|
-
loggedIn: [
|
|
101
|
-
{
|
|
102
|
-
icon: <PersonIcon />,
|
|
103
|
-
name: "Profile",
|
|
104
|
-
action: () => router.push("/user/profile"),
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
icon: <ListAltIcon />,
|
|
108
|
-
name: "Orders",
|
|
109
|
-
action: () => router.push("/user/orders"),
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
icon: <FolderIcon />,
|
|
113
|
-
name: "Documents",
|
|
114
|
-
action: () => router.push("/user/documents"),
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
icon: <KeyboardReturnIcon />,
|
|
118
|
-
name: "Returns",
|
|
119
|
-
action: () => router.push("/user/returns"),
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
icon: <LogoutIcon />,
|
|
123
|
-
name: "Log-Out",
|
|
124
|
-
action: () => signOut({ callbackUrl: "/" }),
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
loggedOut: [
|
|
128
|
-
{
|
|
129
|
-
icon: <LoginIcon />,
|
|
130
|
-
name: "Sign-In",
|
|
131
|
-
action: () => {
|
|
132
|
-
if (cookieConsent.nextCookie === true) {
|
|
133
|
-
signIn();
|
|
134
|
-
} else handleDetailsOpen(true);
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
icon: <HowToRegIcon />,
|
|
139
|
-
name: "Register",
|
|
140
|
-
action: () => Router.push("/auth/register"),
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
}; */
|
|
144
|
-
|
|
145
|
-
/*
|
|
146
|
-
TODO move site-information to the props
|
|
147
|
-
const { siteInformation, isLoading, isError } = useSiteInfo(); */
|
|
148
|
-
|
|
149
|
-
/*
|
|
150
|
-
This does not seem to serve any purpose
|
|
151
|
-
const [anchorElNav, setAnchorElNav] = useState(null);
|
|
152
|
-
|
|
153
|
-
const handleOpenNavMenu = (event) => {
|
|
154
|
-
setAnchorElNav(event.currentTarget);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const handleCloseNavMenu = () => {
|
|
158
|
-
setAnchorElNav(null);
|
|
159
|
-
}; */
|
|
160
|
-
|
|
161
|
-
// shop
|
|
162
|
-
|
|
163
|
-
/*
|
|
164
|
-
TODO REMOVE this does not seem to serve any purpose
|
|
165
|
-
const [shopAnchorEl, setShopAnchorEl] = useState(null);
|
|
166
|
-
const open = Boolean(shopAnchorEl);
|
|
167
|
-
const handleOpenShop = (event) => {
|
|
168
|
-
setShopAnchorEl(event.currentTarget);
|
|
169
|
-
};
|
|
170
|
-
const handleCloseShop = () => {
|
|
171
|
-
setShopAnchorEl(null);
|
|
172
|
-
}; */
|
|
173
|
-
|
|
174
|
-
// handleMobileMenu
|
|
175
|
-
|
|
176
|
-
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
|
177
|
-
|
|
178
|
-
/*
|
|
179
|
-
again this does not seem to serve any purpose
|
|
180
|
-
const mobileMenuId = mobileNavOpen ? "mobile-menu" : undefined; */
|
|
181
|
-
|
|
182
|
-
const handleOpenMobileMenu = (e) => {
|
|
183
|
-
setMobileNavOpen(true);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleCloseMobileMenu = (e) => {
|
|
187
|
-
setMobileNavOpen(false);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/* const Transition = forwardRef(function Transition(props, ref) {
|
|
191
|
-
return <Slide direction="up" ref={ref} {...props} />;
|
|
192
|
-
}); */
|
|
193
|
-
|
|
194
|
-
/* const theme = useTheme();
|
|
195
|
-
|
|
196
|
-
const small = useMediaQuery(theme.breakpoints.down("sm")); */
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<AppBar position="sticky">
|
|
200
|
-
<Container maxWidth="xl">
|
|
201
|
-
<Toolbar disableGutters sx={{py:1}}>
|
|
202
|
-
{/* logo and site title for big screens */}
|
|
203
|
-
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
204
|
-
<Box
|
|
205
|
-
sx={{ display: { xs: "none", md: "flex" }, cursor: "pointer", alignItems: "center"}}
|
|
206
|
-
><Box sx={{ display: "flex", mr: 1 }}>
|
|
207
|
-
<img
|
|
208
|
-
src={logo.url}
|
|
209
|
-
width={logo.width || "32px"}
|
|
210
|
-
height={logo.height || "32px"}
|
|
211
|
-
alt="site logo"
|
|
212
|
-
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
213
|
-
/>
|
|
214
|
-
</Box>
|
|
215
|
-
{site_title !== undefined && (
|
|
216
|
-
<Typography
|
|
217
|
-
|
|
218
|
-
variant="h6"
|
|
219
|
-
noWrap
|
|
220
|
-
component="h1"
|
|
221
|
-
sx={{
|
|
222
|
-
display: "flex",
|
|
223
|
-
textDecoration: "none",
|
|
224
|
-
}}
|
|
225
|
-
>
|
|
226
|
-
{site_title}
|
|
227
|
-
</Typography>
|
|
228
|
-
)}
|
|
229
|
-
</Box>
|
|
230
|
-
</Link>
|
|
231
|
-
|
|
232
|
-
{/* Large screen menu */}
|
|
233
|
-
<Box
|
|
234
|
-
sx={{
|
|
235
|
-
flexGrow: 1,
|
|
236
|
-
display: { xs: "none", md: "flex" },
|
|
237
|
-
alignItems: "center",
|
|
238
|
-
}}
|
|
239
|
-
>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
{pages.map((page) => {
|
|
243
|
-
return (
|
|
244
|
-
<Button
|
|
245
|
-
key={page.name}
|
|
246
|
-
onClick={() => page.action()}
|
|
247
|
-
sx={{ my: 2, color: "primary.contrastText", display: "block" }}
|
|
248
|
-
>
|
|
249
|
-
{page.name}
|
|
250
|
-
</Button>
|
|
251
|
-
)})}
|
|
252
|
-
|
|
253
|
-
</Box>
|
|
254
|
-
|
|
255
|
-
{/* small screen logo and site title */}
|
|
256
|
-
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
257
|
-
<Box sx={{ display: { xs: "flex", md: "none" }, alignItems:"center"}}>
|
|
258
|
-
|
|
259
|
-
{logo.url !== undefined && <Box sx={{ display: "flex", mr: 1 }}>
|
|
260
|
-
<img
|
|
261
|
-
src={logo.url}
|
|
262
|
-
width={logo.width || "32px"}
|
|
263
|
-
height={logo.height || "32px"}
|
|
264
|
-
alt={logo.alt || "site logo"}
|
|
265
|
-
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
266
|
-
/>
|
|
267
|
-
</Box>}
|
|
268
|
-
{site_title !== undefined && <Typography
|
|
269
|
-
variant="h5"
|
|
270
|
-
noWrap
|
|
271
|
-
component="h1"
|
|
272
|
-
sx={{
|
|
273
|
-
display: "flex",
|
|
274
|
-
flexGrow: 1,
|
|
275
|
-
}}
|
|
276
|
-
>
|
|
277
|
-
{site_title}
|
|
278
|
-
</Typography>}
|
|
279
|
-
</Box>
|
|
280
|
-
</Link>
|
|
281
|
-
{/* spacer box */}
|
|
282
|
-
<Box sx={{ display: { xs: "flex", md: "none" }, flexGrow: 1 }}></Box>
|
|
283
|
-
|
|
284
|
-
{/* small screen nav menu */}
|
|
285
|
-
|
|
286
|
-
<Box sx={{ flexGrow: 0, display: { xs: "flex", md: "none" } }}>
|
|
287
|
-
<Button
|
|
288
|
-
onClick={handleOpenMobileMenu}
|
|
289
|
-
sx={{
|
|
290
|
-
width: "40px",
|
|
291
|
-
height: "40px",
|
|
292
|
-
borderRadius: "50%",
|
|
293
|
-
p: 0,
|
|
294
|
-
minWidth: "unset",
|
|
295
|
-
color: "primary.contrastText",
|
|
296
|
-
boxShadow:
|
|
297
|
-
"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)",
|
|
298
|
-
}}
|
|
299
|
-
>
|
|
300
|
-
<MoreVertIcon sx={{ color: "primary.contrastText" }} />
|
|
301
|
-
</Button>
|
|
302
|
-
|
|
303
|
-
<Dialog
|
|
304
|
-
fullScreen
|
|
305
|
-
open={mobileNavOpen}
|
|
306
|
-
onClose={handleCloseMobileMenu}
|
|
307
|
-
>
|
|
308
|
-
<AppBar position="sticky">
|
|
309
|
-
<Container maxWidth="xl">
|
|
310
|
-
<Toolbar disableGutters sx={{py:1, justifyContent:"space-between"}}>
|
|
311
|
-
<Link href="/" style={{textDecoration: "none", color: "unset"}}>
|
|
312
|
-
<Box sx={{display: "flex", flexDirection: "row", alignItems: "center"}}>
|
|
313
|
-
<Box sx={{ display: "flex", mr: 1 }}>
|
|
314
|
-
<img
|
|
315
|
-
src={logo.url}
|
|
316
|
-
alt={logo.alt || "logo"}
|
|
317
|
-
width={logo.width || "32px"}
|
|
318
|
-
height={logo.height || "32px"}
|
|
319
|
-
style={{maxWidth: "60px", maxHeight: "60px"}}
|
|
320
|
-
/>
|
|
321
|
-
</Box>
|
|
322
|
-
<Typography
|
|
323
|
-
variant="h5"
|
|
324
|
-
noWrap
|
|
325
|
-
component="h1"
|
|
326
|
-
sx={{
|
|
327
|
-
display: "flex",
|
|
328
|
-
flexGrow: 1,
|
|
329
|
-
}}
|
|
330
|
-
>
|
|
331
|
-
|
|
332
|
-
{site_title !== undefined && site_title}
|
|
333
|
-
|
|
334
|
-
</Typography>
|
|
335
|
-
</Box>
|
|
336
|
-
</Link>
|
|
337
|
-
<Button
|
|
338
|
-
onClick={handleCloseMobileMenu}
|
|
339
|
-
sx={{
|
|
340
|
-
width: "40px",
|
|
341
|
-
height: "40px",
|
|
342
|
-
borderRadius: "50%",
|
|
343
|
-
p: 0,
|
|
344
|
-
minWidth: "unset",
|
|
345
|
-
color: "primary.contrastText",
|
|
346
|
-
boxShadow:
|
|
347
|
-
"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)",
|
|
348
|
-
}}
|
|
349
|
-
aria-label="close"
|
|
350
|
-
>
|
|
351
|
-
<CloseIcon sx={{ color: "primary.contrastText" }} />
|
|
352
|
-
</Button>
|
|
353
|
-
</Toolbar>
|
|
354
|
-
</Container>
|
|
355
|
-
</AppBar>
|
|
356
|
-
<List>
|
|
357
|
-
{pages.map((page) =>
|
|
358
|
-
{
|
|
359
|
-
return (
|
|
360
|
-
<>
|
|
361
|
-
<ListItem
|
|
362
|
-
key={page.name}
|
|
363
|
-
onClick={() => {page.action(); handleCloseMobileMenu();}}
|
|
364
|
-
>
|
|
365
|
-
<ListItemText primary={page.name} />
|
|
366
|
-
</ListItem>
|
|
367
|
-
<Divider />
|
|
368
|
-
</>
|
|
369
|
-
)})}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
</List>
|
|
374
|
-
</Dialog>
|
|
375
|
-
</Box>
|
|
376
|
-
</Toolbar>
|
|
377
|
-
</Container>
|
|
378
|
-
</AppBar>
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
export default NavBar;
|
|
382
|
-
|
|
383
|
-
// TODO AUTH
|
|
384
|
-
|
|
385
|
-
/*
|
|
386
|
-
TODO: move to a different component
|
|
387
|
-
{auth && (
|
|
388
|
-
<>
|
|
389
|
-
{session &&
|
|
390
|
-
actions.loggedIn.map((action) => (
|
|
391
|
-
<>
|
|
392
|
-
<ListItem
|
|
393
|
-
key={action.name}
|
|
394
|
-
onClick={() => {
|
|
395
|
-
action.action();
|
|
396
|
-
handleCloseMobileMenu();
|
|
397
|
-
}}
|
|
398
|
-
button
|
|
399
|
-
>
|
|
400
|
-
<ListItemIcon>{action.icon}</ListItemIcon>
|
|
401
|
-
<ListItemText primary={action.name} />
|
|
402
|
-
</ListItem>
|
|
403
|
-
<Divider />
|
|
404
|
-
</>
|
|
405
|
-
))}
|
|
406
|
-
{!session &&
|
|
407
|
-
actions.loggedOut.map((action) => (
|
|
408
|
-
<>
|
|
409
|
-
<ListItem
|
|
410
|
-
key={action.name}
|
|
411
|
-
onClick={() => {
|
|
412
|
-
action.action();
|
|
413
|
-
handleCloseMobileMenu();
|
|
414
|
-
}}
|
|
415
|
-
button
|
|
416
|
-
>
|
|
417
|
-
<ListItemIcon>{action.icon}</ListItemIcon>
|
|
418
|
-
<ListItemText primary={action.name} />
|
|
419
|
-
</ListItem>
|
|
420
|
-
<Divider />
|
|
421
|
-
</>
|
|
422
|
-
))}
|
|
423
|
-
</>
|
|
424
|
-
)} */
|
|
425
|
-
|
|
426
|
-
/* Auth for small screens */
|
|
427
|
-
/*
|
|
428
|
-
TODO this should be moved to a different component
|
|
429
|
-
maybe the navbar should have a optional slot prop for this
|
|
430
|
-
also the cart should be moved to a entirly different component
|
|
431
|
-
{auth && (
|
|
432
|
-
<>
|
|
433
|
-
<CartWidget />
|
|
434
|
-
<Box
|
|
435
|
-
sx={{
|
|
436
|
-
display: { xs: "none", md: "flex" },
|
|
437
|
-
flexGrow: 0,
|
|
438
|
-
position: "relative",
|
|
439
|
-
width: "40px",
|
|
440
|
-
height: "40px",
|
|
441
|
-
}}
|
|
442
|
-
>
|
|
443
|
-
<SpeedDial
|
|
444
|
-
ariaLabel="..."
|
|
445
|
-
icon={<AccountCircleIcon />}
|
|
446
|
-
direction="down"
|
|
447
|
-
sx={{
|
|
448
|
-
position: "absolute",
|
|
449
|
-
top: 0,
|
|
450
|
-
right: 0,
|
|
451
|
-
width: 40,
|
|
452
|
-
"& .MuiFab-root": { width: 40, height: 40 },
|
|
453
|
-
}}
|
|
454
|
-
>
|
|
455
|
-
{session &&
|
|
456
|
-
actions.loggedIn.map((action) => (
|
|
457
|
-
<SpeedDialAction
|
|
458
|
-
key={action.name}
|
|
459
|
-
icon={action.icon}
|
|
460
|
-
tooltipTitle={action.name}
|
|
461
|
-
onClick={action.action}
|
|
462
|
-
/>
|
|
463
|
-
))}
|
|
464
|
-
|
|
465
|
-
{!session &&
|
|
466
|
-
actions.loggedOut.map((action) => (
|
|
467
|
-
<SpeedDialAction
|
|
468
|
-
key={action.name}
|
|
469
|
-
icon={action.icon}
|
|
470
|
-
tooltipTitle={action.name}
|
|
471
|
-
onClick={action.action}
|
|
472
|
-
/>
|
|
473
|
-
))}
|
|
474
|
-
</SpeedDial>
|
|
475
|
-
</Box>
|
|
476
|
-
</>
|
|
477
|
-
)} */
|
|
478
|
-
|
|
479
|
-
// TODO COMMERCE
|
|
480
|
-
|
|
481
|
-
/*
|
|
482
|
-
TODO
|
|
483
|
-
move to a different component
|
|
484
|
-
{commerce && (
|
|
485
|
-
<>
|
|
486
|
-
<ListItem
|
|
487
|
-
key="shop"
|
|
488
|
-
onClick={() => {
|
|
489
|
-
router.push("/shop");
|
|
490
|
-
handleCloseMobileMenu();
|
|
491
|
-
}}
|
|
492
|
-
button
|
|
493
|
-
>
|
|
494
|
-
<ListItemText primary={"Shop"} />
|
|
495
|
-
</ListItem>
|
|
496
|
-
<Divider />
|
|
497
|
-
<ListItem
|
|
498
|
-
onClick={() => {
|
|
499
|
-
router.push("/shop/cart");
|
|
500
|
-
handleCloseMobileMenu();
|
|
501
|
-
}}
|
|
502
|
-
button
|
|
503
|
-
>
|
|
504
|
-
<ListItemText primary={"Cart"} />
|
|
505
|
-
</ListItem>
|
|
506
|
-
<Divider />
|
|
507
|
-
<ListItem
|
|
508
|
-
onClick={() => {
|
|
509
|
-
router.push("/shop/checkOut");
|
|
510
|
-
handleCloseMobileMenu();
|
|
511
|
-
}}
|
|
512
|
-
button
|
|
513
|
-
>
|
|
514
|
-
<ListItemText primary={"Check-Out"} />
|
|
515
|
-
</ListItem>
|
|
516
|
-
<Divider /> */
|
|
517
|
-
|
|
518
|
-
/*
|
|
519
|
-
TODO: find a better way, use submenus
|
|
520
|
-
{commerce && (
|
|
521
|
-
<>
|
|
522
|
-
<Box
|
|
523
|
-
sx={{
|
|
524
|
-
display: { xs: "none", md: "block" },
|
|
525
|
-
height: "40px",
|
|
526
|
-
}}
|
|
527
|
-
>
|
|
528
|
-
<StyledShopMenuSpeedDial
|
|
529
|
-
direction="down"
|
|
530
|
-
ariaLabel="Submenu for shop pages"
|
|
531
|
-
icon={<Box key="shopSubMenu">shop</Box>}
|
|
532
|
-
onClick={() => {
|
|
533
|
-
router.push("/shop");
|
|
534
|
-
}}
|
|
535
|
-
>
|
|
536
|
-
<SpeedDialAction
|
|
537
|
-
key="shop"
|
|
538
|
-
icon={<Box>shop</Box>}
|
|
539
|
-
disableHoverListener={true}
|
|
540
|
-
tooltipTitle="shop"
|
|
541
|
-
onClick={() => {
|
|
542
|
-
router.push("/shop");
|
|
543
|
-
}}
|
|
544
|
-
/>
|
|
545
|
-
|
|
546
|
-
<SpeedDialAction
|
|
547
|
-
key="cart"
|
|
548
|
-
icon={<Box>cart</Box>}
|
|
549
|
-
disableHoverListener={true}
|
|
550
|
-
tooltipTitle="cart"
|
|
551
|
-
onClick={() => {
|
|
552
|
-
router.push("/shop/cart");
|
|
553
|
-
}}
|
|
554
|
-
/>
|
|
555
|
-
|
|
556
|
-
<SpeedDialAction
|
|
557
|
-
key="checkOut"
|
|
558
|
-
icon={<Box>checkOut</Box>}
|
|
559
|
-
disableHoverListener={true}
|
|
560
|
-
tooltipTitle="check-out"
|
|
561
|
-
onClick={() => {
|
|
562
|
-
router.push("/shop/checkOut");
|
|
563
|
-
}}
|
|
564
|
-
/>
|
|
565
|
-
</StyledShopMenuSpeedDial>
|
|
566
|
-
</Box>
|
|
567
|
-
</>
|
|
568
|
-
)} */
|
|
1
|
+
export * from "./NavBar";
|