umwd-components 0.1.36 → 0.1.38
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/cjs/_virtual/_rollupPluginBabelHelpers.js +24 -0
- package/dist/cjs/components/Button.js +44 -0
- package/dist/cjs/components/Checkmark/Checkmark.js +29 -0
- package/dist/cjs/components/ContactForm.js +136 -0
- package/dist/cjs/components/Footer.js +173 -0
- package/dist/cjs/components/NavBar.js +286 -0
- package/dist/cjs/components/NoteTextField/NoteTextField.js +21 -0
- package/dist/cjs/components/Page.js +51 -0
- package/dist/cjs/components/Requirement/Requirement.js +28 -0
- package/dist/cjs/components/Requirements/Requirements.js +30 -0
- package/dist/cjs/components/Stack.js +36 -0
- package/dist/cjs/components/TextImageBlock.js +135 -0
- package/dist/cjs/components/Xmark/Xmark.js +27 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/styles.css.js +16 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +22 -0
- package/dist/esm/components/Button.js +40 -0
- package/dist/esm/components/Checkmark/Checkmark.js +27 -0
- package/dist/esm/components/ContactForm.js +132 -0
- package/dist/esm/components/Footer.js +169 -0
- package/dist/esm/components/NavBar.js +282 -0
- package/dist/esm/components/NoteTextField/NoteTextField.js +19 -0
- package/dist/esm/components/Page.js +47 -0
- package/dist/esm/components/Requirement/Requirement.js +26 -0
- package/dist/esm/components/Requirements/Requirements.js +28 -0
- package/dist/esm/components/Stack.js +32 -0
- package/dist/esm/components/TextImageBlock.js +131 -0
- package/dist/esm/components/Xmark/Xmark.js +25 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/styles.css.js +12 -0
- package/package.json +3 -2
- package/src/components/ContactForm.js +103 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
function _extends() {
|
|
10
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
11
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
12
|
+
var source = arguments[i];
|
|
13
|
+
for (var key in source) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
15
|
+
target[key] = source[key];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
return _extends.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.extends = _extends;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
|
+
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var PropTypes = require('prop-types');
|
|
13
|
+
|
|
14
|
+
function Button({
|
|
15
|
+
label,
|
|
16
|
+
backgroundColor = "red",
|
|
17
|
+
size = "md",
|
|
18
|
+
onClick
|
|
19
|
+
}) {
|
|
20
|
+
let scale = 1;
|
|
21
|
+
if (size === "sm") {
|
|
22
|
+
scale = 0.75;
|
|
23
|
+
}
|
|
24
|
+
if (size === "lg") {
|
|
25
|
+
scale = 1.25;
|
|
26
|
+
}
|
|
27
|
+
const style = {
|
|
28
|
+
backgroundColor,
|
|
29
|
+
padding: `${0.5 * scale}rem ${1 * scale}rem`,
|
|
30
|
+
border: "none"
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
33
|
+
style: style,
|
|
34
|
+
onClick: onClick
|
|
35
|
+
}, label);
|
|
36
|
+
}
|
|
37
|
+
Button.propTypes = {
|
|
38
|
+
label: PropTypes.string,
|
|
39
|
+
backgroundColor: PropTypes.string,
|
|
40
|
+
size: PropTypes.oneOf(["sm", "md", "lg"]),
|
|
41
|
+
onClick: PropTypes.func
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.default = Button;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
// Ported from Alexander Haniotis' code here: https://codepen.io/haniotis/pen/KwvYLO
|
|
10
|
+
// import React from "react";
|
|
11
|
+
|
|
12
|
+
const Checkmark = () => {
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
14
|
+
className: "checkmark",
|
|
15
|
+
viewBox: "0 0 52 52"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
17
|
+
className: "checkmark__circle",
|
|
18
|
+
cx: "26",
|
|
19
|
+
cy: "26",
|
|
20
|
+
r: "25",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
className: "checkmark__check",
|
|
24
|
+
fill: "none",
|
|
25
|
+
d: "M14.1 27.2l7.1 7.2 16.7-16.8"
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.Checkmark = Checkmark;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var React = require('react');
|
|
13
|
+
require('prop-types');
|
|
14
|
+
var material = require('@mui/material');
|
|
15
|
+
var isEmail = require('validator/lib/isEmail');
|
|
16
|
+
|
|
17
|
+
function ContactForm({
|
|
18
|
+
...args
|
|
19
|
+
}) {
|
|
20
|
+
const [formValues, setFormValues] = React.useState({
|
|
21
|
+
name: "",
|
|
22
|
+
email: "",
|
|
23
|
+
subject: "",
|
|
24
|
+
message: ""
|
|
25
|
+
});
|
|
26
|
+
const [formErrors, setFormErrors] = React.useState({});
|
|
27
|
+
const handleBlur = e => {
|
|
28
|
+
console.log(e.target.id);
|
|
29
|
+
console.log(e.target.value);
|
|
30
|
+
const errors = validate(formValues);
|
|
31
|
+
console.log(errors);
|
|
32
|
+
setFormErrors({
|
|
33
|
+
...formErrors,
|
|
34
|
+
[e.target.id]: errors[e.target.id]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const handleChange = e => {
|
|
38
|
+
const {
|
|
39
|
+
id,
|
|
40
|
+
value
|
|
41
|
+
} = e.target;
|
|
42
|
+
setFormValues({
|
|
43
|
+
...formValues,
|
|
44
|
+
[id]: value
|
|
45
|
+
});
|
|
46
|
+
console.log("formValues", formValues);
|
|
47
|
+
};
|
|
48
|
+
const handleClear = () => {
|
|
49
|
+
setFormValues({});
|
|
50
|
+
};
|
|
51
|
+
const handleSendCallback = () => {
|
|
52
|
+
console.log("Send callback");
|
|
53
|
+
};
|
|
54
|
+
const validate = values => {
|
|
55
|
+
console.log("values from validate", values);
|
|
56
|
+
let errors = {};
|
|
57
|
+
if (values.name === "") {
|
|
58
|
+
errors.name = "Name is required";
|
|
59
|
+
}
|
|
60
|
+
if (values.email === "") {
|
|
61
|
+
errors.email = "Email is required";
|
|
62
|
+
} else if (!isEmail(values.email)) {
|
|
63
|
+
errors.email = "Invalid email";
|
|
64
|
+
}
|
|
65
|
+
if (values.subject === "") {
|
|
66
|
+
errors.subject = "Subject is required";
|
|
67
|
+
}
|
|
68
|
+
if (values.message === "") {
|
|
69
|
+
errors.message = "Message is required";
|
|
70
|
+
}
|
|
71
|
+
console.log("errors from validate", errors);
|
|
72
|
+
return errors;
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement(material.Stack, {
|
|
75
|
+
spacing: 2
|
|
76
|
+
}, /*#__PURE__*/React.createElement(material.Typography, {
|
|
77
|
+
variant: "h6",
|
|
78
|
+
align: "center"
|
|
79
|
+
}, "Write us"), /*#__PURE__*/React.createElement(material.Typography, {
|
|
80
|
+
variant: "body1",
|
|
81
|
+
align: "center"
|
|
82
|
+
}, "We're open for any suggestion or just to have a chat"), /*#__PURE__*/React.createElement(material.TextField, {
|
|
83
|
+
id: "name",
|
|
84
|
+
label: "Name",
|
|
85
|
+
value: formValues.name,
|
|
86
|
+
variant: "outlined",
|
|
87
|
+
onBlur: e => handleBlur(e),
|
|
88
|
+
onChange: e => handleChange(e),
|
|
89
|
+
error: formErrors.name != undefined ? true : false,
|
|
90
|
+
helperText: formErrors.name
|
|
91
|
+
}), /*#__PURE__*/React.createElement(material.TextField, {
|
|
92
|
+
id: "email",
|
|
93
|
+
label: "Email",
|
|
94
|
+
value: formValues.email,
|
|
95
|
+
variant: "outlined",
|
|
96
|
+
onBlur: handleBlur,
|
|
97
|
+
onChange: handleChange,
|
|
98
|
+
error: formErrors.email != undefined ? true : false,
|
|
99
|
+
helperText: formErrors.email
|
|
100
|
+
}), /*#__PURE__*/React.createElement(material.TextField, {
|
|
101
|
+
id: "subject",
|
|
102
|
+
label: "Subject",
|
|
103
|
+
value: formValues.subject,
|
|
104
|
+
variant: "outlined",
|
|
105
|
+
onBlur: handleBlur,
|
|
106
|
+
onChange: handleChange,
|
|
107
|
+
error: formErrors.subject != undefined,
|
|
108
|
+
helperText: formErrors.subject
|
|
109
|
+
}), /*#__PURE__*/React.createElement(material.TextField, {
|
|
110
|
+
id: "message",
|
|
111
|
+
label: "Message",
|
|
112
|
+
value: formValues.message,
|
|
113
|
+
variant: "outlined",
|
|
114
|
+
multiline: true,
|
|
115
|
+
minRows: 5,
|
|
116
|
+
onBlur: handleBlur,
|
|
117
|
+
onChange: handleChange,
|
|
118
|
+
error: formErrors.message != undefined,
|
|
119
|
+
helperText: formErrors.message
|
|
120
|
+
}), /*#__PURE__*/React.createElement(material.Stack, {
|
|
121
|
+
direction: "row",
|
|
122
|
+
spacing: 2,
|
|
123
|
+
justifyContent: "end"
|
|
124
|
+
}, /*#__PURE__*/React.createElement(material.Button, {
|
|
125
|
+
variant: "outlined",
|
|
126
|
+
color: "primary",
|
|
127
|
+
onClick: () => handleClear
|
|
128
|
+
}, "Clear"), /*#__PURE__*/React.createElement(material.Button, {
|
|
129
|
+
variant: "contained",
|
|
130
|
+
color: "primary",
|
|
131
|
+
onClick: handleSendCallback
|
|
132
|
+
}, "Send")));
|
|
133
|
+
}
|
|
134
|
+
ContactForm.propTypes = {};
|
|
135
|
+
|
|
136
|
+
exports.default = ContactForm;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
|
+
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var material = require('@mui/material');
|
|
13
|
+
var Link = require('next/link');
|
|
14
|
+
var Image = require('next/image');
|
|
15
|
+
var PropTypes = require('prop-types');
|
|
16
|
+
|
|
17
|
+
Footer.propTypes = {
|
|
18
|
+
site_title: PropTypes.string.isRequired,
|
|
19
|
+
site_logo: PropTypes.string,
|
|
20
|
+
company_name: PropTypes.string.isRequired,
|
|
21
|
+
parent_company_name: PropTypes.string,
|
|
22
|
+
company_address: PropTypes.shape({
|
|
23
|
+
street: PropTypes.string,
|
|
24
|
+
street_number: PropTypes.string,
|
|
25
|
+
street_number_addition: PropTypes.string,
|
|
26
|
+
postal_code: PropTypes.string,
|
|
27
|
+
city: PropTypes.string
|
|
28
|
+
}),
|
|
29
|
+
CoC_number: PropTypes.string.isRequired,
|
|
30
|
+
VAT_number: PropTypes.string.isRequired,
|
|
31
|
+
company_socials: PropTypes.arrayOf(PropTypes.shape({
|
|
32
|
+
name: PropTypes.string.isRequired,
|
|
33
|
+
url: PropTypes.string.isRequired,
|
|
34
|
+
icon: PropTypes.elementType
|
|
35
|
+
})),
|
|
36
|
+
disclaimer_link: PropTypes.string,
|
|
37
|
+
privacypolicy_link: PropTypes.string
|
|
38
|
+
};
|
|
39
|
+
function Footer({
|
|
40
|
+
site_title,
|
|
41
|
+
site_logo,
|
|
42
|
+
company_name,
|
|
43
|
+
parent_company_name,
|
|
44
|
+
company_address,
|
|
45
|
+
CoC_number,
|
|
46
|
+
VAT_number,
|
|
47
|
+
company_socials,
|
|
48
|
+
disclaimer_link,
|
|
49
|
+
privacypolicy_link
|
|
50
|
+
}) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(material.AppBar, {
|
|
52
|
+
position: "relative"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(material.Container, {
|
|
54
|
+
maxWidth: "xl"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(material.Toolbar, {
|
|
56
|
+
disableGutters: true
|
|
57
|
+
}, /*#__PURE__*/React.createElement(material.Grid, {
|
|
58
|
+
container: true,
|
|
59
|
+
sx: {
|
|
60
|
+
p: 2
|
|
61
|
+
},
|
|
62
|
+
spacing: 2
|
|
63
|
+
}, /*#__PURE__*/React.createElement(material.Grid, {
|
|
64
|
+
item: true,
|
|
65
|
+
xs: 12,
|
|
66
|
+
sm: 4,
|
|
67
|
+
align: "center"
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
69
|
+
href: "/"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
71
|
+
sx: {
|
|
72
|
+
display: {
|
|
73
|
+
xs: "none",
|
|
74
|
+
md: "flex"
|
|
75
|
+
},
|
|
76
|
+
cursor: "pointer",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center"
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/React.createElement(material.Typography, {
|
|
82
|
+
variant: "h6"
|
|
83
|
+
}, site_title), site_logo && /*#__PURE__*/React.createElement(material.Box, null, /*#__PURE__*/React.createElement(Image, {
|
|
84
|
+
src: site_logo,
|
|
85
|
+
width: 64,
|
|
86
|
+
height: 64,
|
|
87
|
+
alt: "site logo"
|
|
88
|
+
}))))), /*#__PURE__*/React.createElement(material.Grid, {
|
|
89
|
+
item: true,
|
|
90
|
+
xs: 12,
|
|
91
|
+
sm: 4,
|
|
92
|
+
align: "center"
|
|
93
|
+
}, /*#__PURE__*/React.createElement(material.Typography, {
|
|
94
|
+
variant: "h6"
|
|
95
|
+
}, "Contact Information"), /*#__PURE__*/React.createElement(material.Typography, {
|
|
96
|
+
variant: "h6"
|
|
97
|
+
}, company_name), parent_company_name && /*#__PURE__*/React.createElement(material.Typography, {
|
|
98
|
+
variant: "h6"
|
|
99
|
+
}, "By ", parent_company_name), company_address && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(material.Typography, {
|
|
100
|
+
variant: "body1"
|
|
101
|
+
}, company_address.street, " ", company_address.street_number, " ", company_address.street_number_addition && company_address.street_number_addition), /*#__PURE__*/React.createElement(material.Typography, {
|
|
102
|
+
variant: "body1"
|
|
103
|
+
}, company_address.postal_code, " ", company_address.city)), /*#__PURE__*/React.createElement(material.Typography, {
|
|
104
|
+
variant: "body1"
|
|
105
|
+
}, "CoC: ", CoC_number), /*#__PURE__*/React.createElement(material.Typography, {
|
|
106
|
+
variant: "body1"
|
|
107
|
+
}, "VAT: ", VAT_number), /*#__PURE__*/React.createElement(material.Typography, {
|
|
108
|
+
variant: "body1"
|
|
109
|
+
}), /*#__PURE__*/React.createElement(material.Typography, {
|
|
110
|
+
variant: "body1"
|
|
111
|
+
})), /*#__PURE__*/React.createElement(material.Grid, {
|
|
112
|
+
item: true,
|
|
113
|
+
xs: 12,
|
|
114
|
+
sm: 4,
|
|
115
|
+
align: "center"
|
|
116
|
+
}, company_socials.length > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(material.Typography, {
|
|
117
|
+
variant: "h6"
|
|
118
|
+
}, "Socials"), /*#__PURE__*/React.createElement(material.Stack, {
|
|
119
|
+
spacing: 2,
|
|
120
|
+
sx: {
|
|
121
|
+
width: "min-content",
|
|
122
|
+
color: "primary.contrastText"
|
|
123
|
+
}
|
|
124
|
+
}, company_socials.map((company_social, index) => {
|
|
125
|
+
return /*#__PURE__*/React.createElement(material.IconButton, {
|
|
126
|
+
key: index,
|
|
127
|
+
color: "inherit",
|
|
128
|
+
href: company_social.url
|
|
129
|
+
}, company_social.icon);
|
|
130
|
+
})))), /*#__PURE__*/React.createElement(material.Grid, {
|
|
131
|
+
item: true,
|
|
132
|
+
xs: 12
|
|
133
|
+
}, /*#__PURE__*/React.createElement(material.Divider, null)), disclaimer_link && /*#__PURE__*/React.createElement(material.Grid, {
|
|
134
|
+
item: true,
|
|
135
|
+
xs: 12,
|
|
136
|
+
sm: 4,
|
|
137
|
+
sx: {
|
|
138
|
+
display: "flex",
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
alignItems: "center"
|
|
141
|
+
}
|
|
142
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
143
|
+
href: disclaimer_link
|
|
144
|
+
}, /*#__PURE__*/React.createElement(material.Typography, {
|
|
145
|
+
variant: "body1"
|
|
146
|
+
}, "Disclaimer"))), privacypolicy_link && /*#__PURE__*/React.createElement(material.Grid, {
|
|
147
|
+
item: true,
|
|
148
|
+
xs: 12,
|
|
149
|
+
sm: 4,
|
|
150
|
+
sx: {
|
|
151
|
+
display: "flex",
|
|
152
|
+
justifyContent: "center",
|
|
153
|
+
alignItems: "center"
|
|
154
|
+
}
|
|
155
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
156
|
+
href: privacypolicy_link
|
|
157
|
+
}, /*#__PURE__*/React.createElement(material.Typography, {
|
|
158
|
+
variant: "body1"
|
|
159
|
+
}, "Privacy Policy"))), Boolean(disclaimer_link || privacypolicy_link) && /*#__PURE__*/React.createElement(material.Grid, {
|
|
160
|
+
item: true,
|
|
161
|
+
xs: 12
|
|
162
|
+
}, /*#__PURE__*/React.createElement(material.Divider, null)), /*#__PURE__*/React.createElement(material.Grid, {
|
|
163
|
+
item: true,
|
|
164
|
+
xs: 12,
|
|
165
|
+
sx: {
|
|
166
|
+
display: "flex",
|
|
167
|
+
justifyContent: "center",
|
|
168
|
+
alignItems: "center"
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/React.createElement(material.Typography, null, "Made possible by Atelier Paulus"))))));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
exports.default = Footer;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var Link = require('next/link');
|
|
14
|
+
var material = require('@mui/material');
|
|
15
|
+
var CloseIcon = require('@mui/icons-material/Close');
|
|
16
|
+
var MoreVertIcon = require('@mui/icons-material/MoreVert');
|
|
17
|
+
var navigation = require('next/navigation');
|
|
18
|
+
var PropTypes = require('prop-types');
|
|
19
|
+
|
|
20
|
+
NavBar.propTypes = {
|
|
21
|
+
site_title: PropTypes.string,
|
|
22
|
+
logo: PropTypes.shape({
|
|
23
|
+
url: PropTypes.string.isRequired,
|
|
24
|
+
width: PropTypes.string,
|
|
25
|
+
height: PropTypes.string,
|
|
26
|
+
alt: PropTypes.string
|
|
27
|
+
}).isRequired,
|
|
28
|
+
pages: PropTypes.arrayOf(PropTypes.shape({
|
|
29
|
+
name: PropTypes.string.isRequired,
|
|
30
|
+
url: PropTypes.string.isRequired
|
|
31
|
+
})),
|
|
32
|
+
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
name: PropTypes.string.isRequired,
|
|
34
|
+
url: PropTypes.string.isRequired
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
37
|
+
function NavBar({
|
|
38
|
+
site_title,
|
|
39
|
+
logo,
|
|
40
|
+
pages = [],
|
|
41
|
+
tabs = [],
|
|
42
|
+
maxWidth = "xl"
|
|
43
|
+
}) {
|
|
44
|
+
// handleMobileMenu
|
|
45
|
+
|
|
46
|
+
const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
|
|
47
|
+
const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
|
|
48
|
+
const handleOpenMobileMenu = e => {
|
|
49
|
+
setMobileNavOpen(true);
|
|
50
|
+
};
|
|
51
|
+
const handleCloseMobileMenu = e => {
|
|
52
|
+
setMobileNavOpen(false);
|
|
53
|
+
};
|
|
54
|
+
const router = navigation.useRouter();
|
|
55
|
+
const handleChange = (event, newValue) => {
|
|
56
|
+
console.log(newValue);
|
|
57
|
+
setCurrentTab(newValue);
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/React.createElement(material.AppBar, {
|
|
60
|
+
position: "sticky"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(material.Container, {
|
|
62
|
+
maxWidth: maxWidth
|
|
63
|
+
}, /*#__PURE__*/React.createElement(material.Toolbar, {
|
|
64
|
+
disableGutters: true,
|
|
65
|
+
sx: {
|
|
66
|
+
py: 1
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
69
|
+
href: "/",
|
|
70
|
+
style: {
|
|
71
|
+
textDecoration: "none",
|
|
72
|
+
color: "unset"
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
75
|
+
sx: {
|
|
76
|
+
display: {
|
|
77
|
+
xs: "none",
|
|
78
|
+
md: "flex"
|
|
79
|
+
},
|
|
80
|
+
cursor: "pointer",
|
|
81
|
+
alignItems: "center"
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
84
|
+
sx: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
mr: 1
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
89
|
+
src: logo.url,
|
|
90
|
+
width: logo.width || "32px",
|
|
91
|
+
height: logo.height || "32px",
|
|
92
|
+
alt: "site logo",
|
|
93
|
+
style: {
|
|
94
|
+
maxWidth: "60px",
|
|
95
|
+
maxHeight: "60px"
|
|
96
|
+
}
|
|
97
|
+
})), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
|
|
98
|
+
variant: "h6",
|
|
99
|
+
noWrap: true,
|
|
100
|
+
component: "h1",
|
|
101
|
+
sx: {
|
|
102
|
+
display: "flex",
|
|
103
|
+
textDecoration: "none"
|
|
104
|
+
}
|
|
105
|
+
}, site_title))), pages.length > 0 && /*#__PURE__*/React.createElement(material.Box, {
|
|
106
|
+
sx: {
|
|
107
|
+
flexGrow: 1,
|
|
108
|
+
display: {
|
|
109
|
+
xs: "none",
|
|
110
|
+
md: "flex"
|
|
111
|
+
},
|
|
112
|
+
alignItems: "center"
|
|
113
|
+
}
|
|
114
|
+
}, pages.map(page => {
|
|
115
|
+
return /*#__PURE__*/React.createElement(material.Button, {
|
|
116
|
+
key: page.name,
|
|
117
|
+
onClick: () => {
|
|
118
|
+
router.push(page.url);
|
|
119
|
+
},
|
|
120
|
+
sx: {
|
|
121
|
+
my: 2,
|
|
122
|
+
color: "primary.contrastText",
|
|
123
|
+
display: "block"
|
|
124
|
+
}
|
|
125
|
+
}, page.name);
|
|
126
|
+
})), /*#__PURE__*/React.createElement(Link, {
|
|
127
|
+
href: "/",
|
|
128
|
+
style: {
|
|
129
|
+
textDecoration: "none",
|
|
130
|
+
color: "unset"
|
|
131
|
+
}
|
|
132
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
133
|
+
sx: {
|
|
134
|
+
display: {
|
|
135
|
+
xs: "flex",
|
|
136
|
+
md: "none"
|
|
137
|
+
},
|
|
138
|
+
alignItems: "center"
|
|
139
|
+
}
|
|
140
|
+
}, logo.url !== undefined && /*#__PURE__*/React.createElement(material.Box, {
|
|
141
|
+
sx: {
|
|
142
|
+
display: "flex",
|
|
143
|
+
mr: 1
|
|
144
|
+
}
|
|
145
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
146
|
+
src: logo.url,
|
|
147
|
+
width: logo.width || "32px",
|
|
148
|
+
height: logo.height || "32px",
|
|
149
|
+
alt: logo.alt || "site logo",
|
|
150
|
+
style: {
|
|
151
|
+
maxWidth: "60px",
|
|
152
|
+
maxHeight: "60px"
|
|
153
|
+
}
|
|
154
|
+
})), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
|
|
155
|
+
variant: "h5",
|
|
156
|
+
noWrap: true,
|
|
157
|
+
component: "h1",
|
|
158
|
+
sx: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
flexGrow: 1
|
|
161
|
+
}
|
|
162
|
+
}, site_title))), /*#__PURE__*/React.createElement(material.Box, {
|
|
163
|
+
sx: {
|
|
164
|
+
display: {
|
|
165
|
+
xs: "flex",
|
|
166
|
+
md: "none"
|
|
167
|
+
},
|
|
168
|
+
flexGrow: 1
|
|
169
|
+
}
|
|
170
|
+
}), /*#__PURE__*/React.createElement(material.Box, {
|
|
171
|
+
sx: {
|
|
172
|
+
flexGrow: 0,
|
|
173
|
+
display: {
|
|
174
|
+
xs: "flex",
|
|
175
|
+
md: "none"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, /*#__PURE__*/React.createElement(material.Button, {
|
|
179
|
+
onClick: handleOpenMobileMenu,
|
|
180
|
+
sx: {
|
|
181
|
+
width: "40px",
|
|
182
|
+
height: "40px",
|
|
183
|
+
borderRadius: "50%",
|
|
184
|
+
p: 0,
|
|
185
|
+
minWidth: "unset",
|
|
186
|
+
color: "primary.contrastText",
|
|
187
|
+
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)"
|
|
188
|
+
}
|
|
189
|
+
}, /*#__PURE__*/React.createElement(MoreVertIcon, {
|
|
190
|
+
sx: {
|
|
191
|
+
color: "primary.contrastText"
|
|
192
|
+
}
|
|
193
|
+
})), /*#__PURE__*/React.createElement(material.Dialog, {
|
|
194
|
+
fullScreen: true,
|
|
195
|
+
open: mobileNavOpen,
|
|
196
|
+
onClose: handleCloseMobileMenu
|
|
197
|
+
}, /*#__PURE__*/React.createElement(material.AppBar, {
|
|
198
|
+
position: "sticky"
|
|
199
|
+
}, /*#__PURE__*/React.createElement(material.Container, {
|
|
200
|
+
maxWidth: "xl"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(material.Toolbar, {
|
|
202
|
+
disableGutters: true,
|
|
203
|
+
sx: {
|
|
204
|
+
py: 1,
|
|
205
|
+
justifyContent: "space-between"
|
|
206
|
+
}
|
|
207
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
208
|
+
href: "/",
|
|
209
|
+
style: {
|
|
210
|
+
textDecoration: "none",
|
|
211
|
+
color: "unset"
|
|
212
|
+
}
|
|
213
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
214
|
+
sx: {
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "row",
|
|
217
|
+
alignItems: "center"
|
|
218
|
+
}
|
|
219
|
+
}, /*#__PURE__*/React.createElement(material.Box, {
|
|
220
|
+
sx: {
|
|
221
|
+
display: "flex",
|
|
222
|
+
mr: 1
|
|
223
|
+
}
|
|
224
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
225
|
+
src: logo.url,
|
|
226
|
+
alt: logo.alt || "logo",
|
|
227
|
+
width: logo.width || "32px",
|
|
228
|
+
height: logo.height || "32px",
|
|
229
|
+
style: {
|
|
230
|
+
maxWidth: "60px",
|
|
231
|
+
maxHeight: "60px"
|
|
232
|
+
}
|
|
233
|
+
})), /*#__PURE__*/React.createElement(material.Typography, {
|
|
234
|
+
variant: "h5",
|
|
235
|
+
noWrap: true,
|
|
236
|
+
component: "h1",
|
|
237
|
+
sx: {
|
|
238
|
+
display: "flex",
|
|
239
|
+
flexGrow: 1
|
|
240
|
+
}
|
|
241
|
+
}, site_title !== undefined && site_title))), /*#__PURE__*/React.createElement(material.Button, {
|
|
242
|
+
onClick: handleCloseMobileMenu,
|
|
243
|
+
sx: {
|
|
244
|
+
width: "40px",
|
|
245
|
+
height: "40px",
|
|
246
|
+
borderRadius: "50%",
|
|
247
|
+
p: 0,
|
|
248
|
+
minWidth: "unset",
|
|
249
|
+
color: "primary.contrastText",
|
|
250
|
+
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)"
|
|
251
|
+
},
|
|
252
|
+
"aria-label": "close"
|
|
253
|
+
}, /*#__PURE__*/React.createElement(CloseIcon, {
|
|
254
|
+
sx: {
|
|
255
|
+
color: "primary.contrastText"
|
|
256
|
+
}
|
|
257
|
+
}))))), pages.length > 0 && /*#__PURE__*/React.createElement(material.List, null, pages.map(page => {
|
|
258
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(material.ListItem, {
|
|
259
|
+
key: page.name,
|
|
260
|
+
onClick: () => {
|
|
261
|
+
router.push(page.url);
|
|
262
|
+
handleCloseMobileMenu();
|
|
263
|
+
}
|
|
264
|
+
}, /*#__PURE__*/React.createElement(material.ListItemText, {
|
|
265
|
+
primary: page.name
|
|
266
|
+
})), /*#__PURE__*/React.createElement(material.Divider, null));
|
|
267
|
+
}))))), tabs.length > 0 && /*#__PURE__*/React.createElement(material.Tabs, {
|
|
268
|
+
value: currentTab,
|
|
269
|
+
onChange: (event, newValue) => handleChange(event, newValue),
|
|
270
|
+
"aria-label": "wrapped label tabs example",
|
|
271
|
+
textColor: "secondary",
|
|
272
|
+
indicatorColor: "secondary",
|
|
273
|
+
variant: "fullWidth"
|
|
274
|
+
}, tabs.length > 0 && tabs.map(tab => {
|
|
275
|
+
return /*#__PURE__*/React.createElement(material.Tab, {
|
|
276
|
+
key: tab.name,
|
|
277
|
+
value: tab.name,
|
|
278
|
+
label: tab.name,
|
|
279
|
+
onClick: () => {
|
|
280
|
+
router.push(tab.url);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}))));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
exports.default = NavBar;
|