umwd-components 0.1.32 → 0.1.33

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.
@@ -44,7 +44,7 @@ function NavBar({
44
44
  // handleMobileMenu
45
45
 
46
46
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
47
- React.useState(tabs[0].name || "");
47
+ const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
48
48
  const handleOpenMobileMenu = e => {
49
49
  setMobileNavOpen(true);
50
50
  };
@@ -52,6 +52,10 @@ function NavBar({
52
52
  setMobileNavOpen(false);
53
53
  };
54
54
  const router = navigation.useRouter();
55
+ const handleChange = (event, newValue) => {
56
+ console.log(newValue);
57
+ setCurrentTab(newValue);
58
+ };
55
59
  return /*#__PURE__*/React.createElement(material.AppBar, {
56
60
  position: "sticky"
57
61
  }, /*#__PURE__*/React.createElement(material.Container, {
@@ -261,8 +265,8 @@ function NavBar({
261
265
  primary: page.name
262
266
  })), /*#__PURE__*/React.createElement(material.Divider, null));
263
267
  }))))), tabs.length > 0 && /*#__PURE__*/React.createElement(material.Tabs, {
264
- value: "one"
265
- /* onChange={handleChange} */,
268
+ value: currentTab,
269
+ onChange: (event, newValue) => handleChange(event, newValue),
266
270
  "aria-label": "wrapped label tabs example",
267
271
  textColor: "secondary",
268
272
  indicatorColor: "secondary",
@@ -40,7 +40,7 @@ function NavBar({
40
40
  // handleMobileMenu
41
41
 
42
42
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
43
- React.useState(tabs[0].name || "");
43
+ const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
44
44
  const handleOpenMobileMenu = e => {
45
45
  setMobileNavOpen(true);
46
46
  };
@@ -48,6 +48,10 @@ function NavBar({
48
48
  setMobileNavOpen(false);
49
49
  };
50
50
  const router = useRouter();
51
+ const handleChange = (event, newValue) => {
52
+ console.log(newValue);
53
+ setCurrentTab(newValue);
54
+ };
51
55
  return /*#__PURE__*/React.createElement(AppBar, {
52
56
  position: "sticky"
53
57
  }, /*#__PURE__*/React.createElement(Container, {
@@ -257,8 +261,8 @@ function NavBar({
257
261
  primary: page.name
258
262
  })), /*#__PURE__*/React.createElement(Divider, null));
259
263
  }))))), tabs.length > 0 && /*#__PURE__*/React.createElement(Tabs, {
260
- value: "one"
261
- /* onChange={handleChange} */,
264
+ value: currentTab,
265
+ onChange: (event, newValue) => handleChange(event, newValue),
262
266
  "aria-label": "wrapped label tabs example",
263
267
  textColor: "secondary",
264
268
  indicatorColor: "secondary",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -52,7 +52,7 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
52
52
 
53
53
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
54
54
 
55
- const [currentTab, setCurrentTab] = React.useState(tabs[0].name || "");
55
+ const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
56
56
 
57
57
  const handleOpenMobileMenu = (e) => {
58
58
  setMobileNavOpen(true);
@@ -64,6 +64,12 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
64
64
 
65
65
  const router = useRouter();
66
66
 
67
+ const handleChange = (event, newValue) => {
68
+ console.log(newValue);
69
+
70
+ setCurrentTab(newValue);
71
+ };
72
+
67
73
  return (
68
74
  <AppBar position="sticky">
69
75
  <Container maxWidth={maxWidth}>
@@ -274,8 +280,8 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
274
280
  {/* Tabs */}
275
281
  {tabs.length > 0 && (
276
282
  <Tabs
277
- value={"one"}
278
- /* onChange={handleChange} */
283
+ value={currentTab}
284
+ onChange={(event, newValue) => handleChange(event, newValue)}
279
285
  aria-label="wrapped label tabs example"
280
286
  textColor="secondary"
281
287
  indicatorColor="secondary"