umwd-components 0.1.32 → 0.1.34
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/components/NavBar.js +7 -3
- package/dist/cjs/components/Page.js +14 -3
- package/dist/esm/components/NavBar.js +7 -3
- package/dist/esm/components/Page.js +14 -3
- package/package.json +1 -1
- package/src/components/NavBar.js +9 -3
- package/src/components/Page.js +20 -9
- package/src/stories/Page.stories.js +7 -6
|
@@ -44,7 +44,7 @@ function NavBar({
|
|
|
44
44
|
// handleMobileMenu
|
|
45
45
|
|
|
46
46
|
const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
|
|
47
|
-
React.useState(tabs[0]
|
|
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:
|
|
265
|
-
|
|
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",
|
|
@@ -12,22 +12,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var TextImageBlock = require('./TextImageBlock.js');
|
|
15
|
+
var material = require('@mui/material');
|
|
15
16
|
|
|
16
17
|
function Page({
|
|
18
|
+
page_title,
|
|
19
|
+
page_description,
|
|
17
20
|
page_blocks
|
|
18
21
|
}) {
|
|
19
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
20
|
-
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(material.Typography, {
|
|
23
|
+
variant: "h1",
|
|
24
|
+
align: "center"
|
|
25
|
+
}, page_title), /*#__PURE__*/React.createElement(material.Typography, {
|
|
26
|
+
variant: "h6",
|
|
27
|
+
align: "center"
|
|
28
|
+
}, page_description), page_blocks.map((block, index) => {
|
|
29
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextImageBlock.default, {
|
|
21
30
|
key: index,
|
|
22
31
|
block_title: block.block_title,
|
|
23
32
|
text_content: block.text_content,
|
|
24
33
|
image_content: block.image_content,
|
|
25
34
|
reverse: block.reverse,
|
|
26
35
|
maxWidth: block.maxWidth
|
|
27
|
-
});
|
|
36
|
+
}));
|
|
28
37
|
}));
|
|
29
38
|
}
|
|
30
39
|
Page.propTypes = {
|
|
40
|
+
page_title: PropTypes.string,
|
|
41
|
+
page_description: PropTypes.string,
|
|
31
42
|
page_blocks: PropTypes.arrayOf(PropTypes.shape({
|
|
32
43
|
block_title: PropTypes.string,
|
|
33
44
|
text_content: PropTypes.string,
|
|
@@ -40,7 +40,7 @@ function NavBar({
|
|
|
40
40
|
// handleMobileMenu
|
|
41
41
|
|
|
42
42
|
const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
|
|
43
|
-
React.useState(tabs[0]
|
|
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:
|
|
261
|
-
|
|
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",
|
|
@@ -8,22 +8,33 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import TextImageBlock from './TextImageBlock.js';
|
|
11
|
+
import { Typography } from '@mui/material';
|
|
11
12
|
|
|
12
13
|
function Page({
|
|
14
|
+
page_title,
|
|
15
|
+
page_description,
|
|
13
16
|
page_blocks
|
|
14
17
|
}) {
|
|
15
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
16
|
-
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
19
|
+
variant: "h1",
|
|
20
|
+
align: "center"
|
|
21
|
+
}, page_title), /*#__PURE__*/React.createElement(Typography, {
|
|
22
|
+
variant: "h6",
|
|
23
|
+
align: "center"
|
|
24
|
+
}, page_description), page_blocks.map((block, index) => {
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextImageBlock, {
|
|
17
26
|
key: index,
|
|
18
27
|
block_title: block.block_title,
|
|
19
28
|
text_content: block.text_content,
|
|
20
29
|
image_content: block.image_content,
|
|
21
30
|
reverse: block.reverse,
|
|
22
31
|
maxWidth: block.maxWidth
|
|
23
|
-
});
|
|
32
|
+
}));
|
|
24
33
|
}));
|
|
25
34
|
}
|
|
26
35
|
Page.propTypes = {
|
|
36
|
+
page_title: PropTypes.string,
|
|
37
|
+
page_description: PropTypes.string,
|
|
27
38
|
page_blocks: PropTypes.arrayOf(PropTypes.shape({
|
|
28
39
|
block_title: PropTypes.string,
|
|
29
40
|
text_content: PropTypes.string,
|
package/package.json
CHANGED
package/src/components/NavBar.js
CHANGED
|
@@ -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]
|
|
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={
|
|
278
|
-
|
|
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"
|
package/src/components/Page.js
CHANGED
|
@@ -3,20 +3,29 @@
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import TextImageBlock from "./TextImageBlock";
|
|
6
|
+
import { Typography } from "@mui/material";
|
|
6
7
|
|
|
7
|
-
function Page({ page_blocks }) {
|
|
8
|
+
function Page({ page_title, page_description, page_blocks }) {
|
|
8
9
|
return (
|
|
9
10
|
<>
|
|
11
|
+
<Typography variant="h1" align="center">
|
|
12
|
+
{page_title}
|
|
13
|
+
</Typography>
|
|
14
|
+
<Typography variant="h6" align="center">
|
|
15
|
+
{page_description}
|
|
16
|
+
</Typography>
|
|
10
17
|
{page_blocks.map((block, index) => {
|
|
11
18
|
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
<>
|
|
20
|
+
<TextImageBlock
|
|
21
|
+
key={index}
|
|
22
|
+
block_title={block.block_title}
|
|
23
|
+
text_content={block.text_content}
|
|
24
|
+
image_content={block.image_content}
|
|
25
|
+
reverse={block.reverse}
|
|
26
|
+
maxWidth={block.maxWidth}
|
|
27
|
+
/>
|
|
28
|
+
</>
|
|
20
29
|
);
|
|
21
30
|
})}
|
|
22
31
|
</>
|
|
@@ -24,6 +33,8 @@ function Page({ page_blocks }) {
|
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
Page.propTypes = {
|
|
36
|
+
page_title: PropTypes.string,
|
|
37
|
+
page_description: PropTypes.string,
|
|
27
38
|
page_blocks: PropTypes.arrayOf(
|
|
28
39
|
PropTypes.shape({
|
|
29
40
|
block_title: PropTypes.string,
|
|
@@ -8,17 +8,18 @@ export default {
|
|
|
8
8
|
// argTypes: { numberOfChildren: { type: "number" } },
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const Template = ({ blocks, ...args }) => (
|
|
12
|
-
<Page
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const Template = ({ page_title, page_description, blocks, ...args }) => (
|
|
12
|
+
<Page
|
|
13
|
+
page_title={page_title}
|
|
14
|
+
page_description={page_description}
|
|
15
|
+
page_blocks={blocks}
|
|
16
|
+
/>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
export const HelloWorld = Template.bind({});
|
|
20
20
|
|
|
21
21
|
HelloWorld.args = {
|
|
22
|
+
page_title: "Hello Cruel World",
|
|
22
23
|
blocks: [
|
|
23
24
|
{
|
|
24
25
|
block_title: "Hello World",
|