umwd-components 0.1.42 → 0.1.44

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.
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var React = require('react');
13
13
  var Link = require('next/link');
14
+ var Image = require('next/image');
14
15
  var material = require('@mui/material');
15
16
  var CloseIcon = require('@mui/icons-material/Close');
16
17
  var MoreVertIcon = require('@mui/icons-material/MoreVert');
@@ -80,21 +81,15 @@ function NavBar({
80
81
  cursor: "pointer",
81
82
  alignItems: "center"
82
83
  }
83
- }, /*#__PURE__*/React.createElement(material.Box, {
84
- sx: {
85
- display: "flex",
86
- mr: 1
87
- }
88
- }, /*#__PURE__*/React.createElement("img", {
84
+ }, /*#__PURE__*/React.createElement(Image, {
89
85
  src: logo.url,
90
- width: logo.width || "32px",
91
- height: logo.height || "32px",
92
- alt: "site logo",
86
+ width: logo.height >= 50 ? logo.width / logo.height * 50 : logo.width,
87
+ height: logo.height,
88
+ alt: logo.alt || "site logo",
93
89
  style: {
94
- maxWidth: "60px",
95
- maxHeight: "60px"
90
+ maxHeight: "50px"
96
91
  }
97
- })), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
92
+ }), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
98
93
  variant: "h6",
99
94
  noWrap: true,
100
95
  component: "h1",
@@ -102,7 +97,12 @@ function NavBar({
102
97
  display: "flex",
103
98
  textDecoration: "none"
104
99
  }
105
- }, site_title))), pages.length > 0 && /*#__PURE__*/React.createElement(material.Box, {
100
+ }, site_title))), /*#__PURE__*/React.createElement(material.Box, {
101
+ sx: {
102
+ display: "block",
103
+ width: "30px"
104
+ }
105
+ }), pages.length > 0 && /*#__PURE__*/React.createElement(material.Box, {
106
106
  sx: {
107
107
  flexGrow: 1,
108
108
  display: {
@@ -123,7 +123,31 @@ function NavBar({
123
123
  display: "block"
124
124
  }
125
125
  }, page.name);
126
- })), /*#__PURE__*/React.createElement(Link, {
126
+ })), tabs.length > 0 && /*#__PURE__*/React.createElement(material.Box, {
127
+ sx: {
128
+ flexGrow: 1,
129
+ display: {
130
+ xs: "none",
131
+ md: "flex"
132
+ }
133
+ }
134
+ }, /*#__PURE__*/React.createElement(material.Tabs, {
135
+ value: currentTab,
136
+ onChange: (event, newValue) => handleChange(event, newValue),
137
+ "aria-label": "wrapped label tabs example",
138
+ textColor: "secondary",
139
+ indicatorColor: "secondary",
140
+ variant: "fullWidth"
141
+ }, tabs.length > 0 && tabs.map(tab => {
142
+ return /*#__PURE__*/React.createElement(material.Tab, {
143
+ key: tab.name,
144
+ value: tab.name,
145
+ label: tab.name,
146
+ onClick: () => {
147
+ router.push(tab.url);
148
+ }
149
+ });
150
+ }))), /*#__PURE__*/React.createElement(Link, {
127
151
  href: "/",
128
152
  style: {
129
153
  textDecoration: "none",
@@ -264,23 +288,7 @@ function NavBar({
264
288
  }, /*#__PURE__*/React.createElement(material.ListItemText, {
265
289
  primary: page.name
266
290
  })), /*#__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
- }))));
291
+ })))))));
284
292
  }
285
293
 
286
294
  exports.default = NavBar;
@@ -7,7 +7,8 @@
7
7
 
8
8
  import React from 'react';
9
9
  import Link from 'next/link';
10
- import { AppBar, Container, Toolbar, Box, Typography, Button, Dialog, List, ListItem, ListItemText, Divider, Tabs, Tab } from '@mui/material';
10
+ import Image from 'next/image';
11
+ import { AppBar, Container, Toolbar, Box, Typography, Button, Tabs, Tab, Dialog, List, ListItem, ListItemText, Divider } from '@mui/material';
11
12
  import CloseIcon from '@mui/icons-material/Close';
12
13
  import MoreVertIcon from '@mui/icons-material/MoreVert';
13
14
  import { useRouter } from 'next/navigation';
@@ -76,21 +77,15 @@ function NavBar({
76
77
  cursor: "pointer",
77
78
  alignItems: "center"
78
79
  }
79
- }, /*#__PURE__*/React.createElement(Box, {
80
- sx: {
81
- display: "flex",
82
- mr: 1
83
- }
84
- }, /*#__PURE__*/React.createElement("img", {
80
+ }, /*#__PURE__*/React.createElement(Image, {
85
81
  src: logo.url,
86
- width: logo.width || "32px",
87
- height: logo.height || "32px",
88
- alt: "site logo",
82
+ width: logo.height >= 50 ? logo.width / logo.height * 50 : logo.width,
83
+ height: logo.height,
84
+ alt: logo.alt || "site logo",
89
85
  style: {
90
- maxWidth: "60px",
91
- maxHeight: "60px"
86
+ maxHeight: "50px"
92
87
  }
93
- })), site_title !== undefined && /*#__PURE__*/React.createElement(Typography, {
88
+ }), site_title !== undefined && /*#__PURE__*/React.createElement(Typography, {
94
89
  variant: "h6",
95
90
  noWrap: true,
96
91
  component: "h1",
@@ -98,7 +93,12 @@ function NavBar({
98
93
  display: "flex",
99
94
  textDecoration: "none"
100
95
  }
101
- }, site_title))), pages.length > 0 && /*#__PURE__*/React.createElement(Box, {
96
+ }, site_title))), /*#__PURE__*/React.createElement(Box, {
97
+ sx: {
98
+ display: "block",
99
+ width: "30px"
100
+ }
101
+ }), pages.length > 0 && /*#__PURE__*/React.createElement(Box, {
102
102
  sx: {
103
103
  flexGrow: 1,
104
104
  display: {
@@ -119,7 +119,31 @@ function NavBar({
119
119
  display: "block"
120
120
  }
121
121
  }, page.name);
122
- })), /*#__PURE__*/React.createElement(Link, {
122
+ })), tabs.length > 0 && /*#__PURE__*/React.createElement(Box, {
123
+ sx: {
124
+ flexGrow: 1,
125
+ display: {
126
+ xs: "none",
127
+ md: "flex"
128
+ }
129
+ }
130
+ }, /*#__PURE__*/React.createElement(Tabs, {
131
+ value: currentTab,
132
+ onChange: (event, newValue) => handleChange(event, newValue),
133
+ "aria-label": "wrapped label tabs example",
134
+ textColor: "secondary",
135
+ indicatorColor: "secondary",
136
+ variant: "fullWidth"
137
+ }, tabs.length > 0 && tabs.map(tab => {
138
+ return /*#__PURE__*/React.createElement(Tab, {
139
+ key: tab.name,
140
+ value: tab.name,
141
+ label: tab.name,
142
+ onClick: () => {
143
+ router.push(tab.url);
144
+ }
145
+ });
146
+ }))), /*#__PURE__*/React.createElement(Link, {
123
147
  href: "/",
124
148
  style: {
125
149
  textDecoration: "none",
@@ -260,23 +284,7 @@ function NavBar({
260
284
  }, /*#__PURE__*/React.createElement(ListItemText, {
261
285
  primary: page.name
262
286
  })), /*#__PURE__*/React.createElement(Divider, null));
263
- }))))), tabs.length > 0 && /*#__PURE__*/React.createElement(Tabs, {
264
- value: currentTab,
265
- onChange: (event, newValue) => handleChange(event, newValue),
266
- "aria-label": "wrapped label tabs example",
267
- textColor: "secondary",
268
- indicatorColor: "secondary",
269
- variant: "fullWidth"
270
- }, tabs.length > 0 && tabs.map(tab => {
271
- return /*#__PURE__*/React.createElement(Tab, {
272
- key: tab.name,
273
- value: tab.name,
274
- label: tab.name,
275
- onClick: () => {
276
- router.push(tab.url);
277
- }
278
- });
279
- }))));
287
+ })))))));
280
288
  }
281
289
 
282
290
  export { NavBar as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
Binary file
Binary file
Binary file
Binary file
@@ -2,6 +2,7 @@
2
2
 
3
3
  import React from "react";
4
4
  import Link from "next/link";
5
+ import Image from "next/image";
5
6
 
6
7
  import {
7
8
  Dialog,
@@ -83,7 +84,7 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
83
84
  alignItems: "center",
84
85
  }}
85
86
  >
86
- <Box sx={{ display: "flex", mr: 1 }}>
87
+ {/* <Box sx={{ display: "flex", mr: 1 }}>
87
88
  <img
88
89
  src={logo.url}
89
90
  width={logo.width || "32px"}
@@ -91,7 +92,18 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
91
92
  alt="site logo"
92
93
  style={{ maxWidth: "60px", maxHeight: "60px" }}
93
94
  />
94
- </Box>
95
+ </Box> */}
96
+ <Image
97
+ src={logo.url}
98
+ width={
99
+ logo.height >= 50
100
+ ? (logo.width / logo.height) * 50
101
+ : logo.width
102
+ }
103
+ height={logo.height}
104
+ alt={logo.alt || "site logo"}
105
+ style={{ maxHeight: "50px" }}
106
+ />
95
107
  {site_title !== undefined && (
96
108
  <Typography
97
109
  variant="h6"
@@ -108,6 +120,8 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
108
120
  </Box>
109
121
  </Link>
110
122
 
123
+ <Box sx={{ display: "block", width: "30px" }}></Box>
124
+
111
125
  {/* Large screen menu */}
112
126
  {pages.length > 0 && (
113
127
  <Box
@@ -137,6 +151,39 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
137
151
  </Box>
138
152
  )}
139
153
 
154
+ {/* Tabs */}
155
+ {tabs.length > 0 && (
156
+ <Box
157
+ sx={{
158
+ flexGrow: 1,
159
+ display: { xs: "none", md: "flex" },
160
+ }}
161
+ >
162
+ <Tabs
163
+ value={currentTab}
164
+ onChange={(event, newValue) => handleChange(event, newValue)}
165
+ aria-label="wrapped label tabs example"
166
+ textColor="secondary"
167
+ indicatorColor="secondary"
168
+ variant="fullWidth"
169
+ >
170
+ {tabs.length > 0 &&
171
+ tabs.map((tab) => {
172
+ return (
173
+ <Tab
174
+ key={tab.name}
175
+ value={tab.name}
176
+ label={tab.name}
177
+ onClick={() => {
178
+ router.push(tab.url);
179
+ }}
180
+ />
181
+ );
182
+ })}
183
+ </Tabs>
184
+ </Box>
185
+ )}
186
+
140
187
  {/* small screen logo and site title */}
141
188
  <Link href="/" style={{ textDecoration: "none", color: "unset" }}>
142
189
  <Box
@@ -276,32 +323,6 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
276
323
  </Dialog>
277
324
  </Box>
278
325
  </Toolbar>
279
-
280
- {/* Tabs */}
281
- {tabs.length > 0 && (
282
- <Tabs
283
- value={currentTab}
284
- onChange={(event, newValue) => handleChange(event, newValue)}
285
- aria-label="wrapped label tabs example"
286
- textColor="secondary"
287
- indicatorColor="secondary"
288
- variant="fullWidth"
289
- >
290
- {tabs.length > 0 &&
291
- tabs.map((tab) => {
292
- return (
293
- <Tab
294
- key={tab.name}
295
- value={tab.name}
296
- label={tab.name}
297
- onClick={() => {
298
- router.push(tab.url);
299
- }}
300
- />
301
- );
302
- })}
303
- </Tabs>
304
- )}
305
326
  </Container>
306
327
  </AppBar>
307
328
  );
@@ -1,6 +1,7 @@
1
1
  import NavBar from "../components/NavBar";
2
2
  import React from "react";
3
3
  import thumbnail from "../../public/placeholders/thumbnail_100X100.png";
4
+ import logoText from "../../public/logo_text.png";
4
5
 
5
6
  export default {
6
7
  title: "UMWD/NavBar",
@@ -65,3 +66,31 @@ UMWD.args = {
65
66
  },
66
67
  ],
67
68
  };
69
+
70
+ export const AMH = Template.bind({});
71
+
72
+ AMH.args = {
73
+ logo: {
74
+ url: logoText.src,
75
+ width: logoText.width,
76
+ height: logoText.height,
77
+ alt: "Logo",
78
+ },
79
+ tabs: [
80
+ {
81
+ name: "Resources",
82
+ link: "/resources",
83
+ action: () => console.log("Services"),
84
+ },
85
+ {
86
+ name: "Shop",
87
+ link: "/shop",
88
+ action: () => console.log("About"),
89
+ },
90
+ {
91
+ name: "Contact",
92
+ link: "/contact",
93
+ action: () => console.log("Contact"),
94
+ },
95
+ ],
96
+ };
Binary file
Binary file