umwd-components 0.1.45 → 0.1.47

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.
@@ -5,6 +5,7 @@ const config = {
5
5
  "@storybook/addon-essentials",
6
6
  "@storybook/addon-onboarding",
7
7
  "@storybook/addon-interactions",
8
+ "@storybook/addon-themes",
8
9
  ],
9
10
  framework: {
10
11
  name: "@storybook/nextjs",
@@ -1,4 +1,14 @@
1
1
  /** @type { import('@storybook/react').Preview } */
2
+ import "@fontsource/roboto/300.css";
3
+ import "@fontsource/roboto/400.css";
4
+ import "@fontsource/roboto/500.css";
5
+ import "@fontsource/roboto/700.css";
6
+ import "@fontsource/material-icons";
7
+
8
+ import { CssBaseline, ThemeProvider } from "@mui/material";
9
+ import { withThemeFromJSXProvider } from "@storybook/addon-themes";
10
+ import { lightTheme, darkTheme } from "../src/styles/themes.js";
11
+
2
12
  const preview = {
3
13
  parameters: {
4
14
  actions: { argTypesRegex: "^on[A-Z].*" },
@@ -12,4 +22,16 @@ const preview = {
12
22
  },
13
23
  };
14
24
 
25
+ export const decorators = [
26
+ withThemeFromJSXProvider({
27
+ themes: {
28
+ light: lightTheme,
29
+ dark: darkTheme,
30
+ },
31
+ defaultTheme: "light",
32
+ Provider: ThemeProvider,
33
+ GlobalStyles: CssBaseline,
34
+ }),
35
+ ];
36
+
15
37
  export default preview;
@@ -51,12 +51,13 @@ function Footer({
51
51
  VAT_number,
52
52
  company_socials,
53
53
  disclaimer_link,
54
- privacypolicy_link
54
+ privacypolicy_link,
55
+ maxWidth = "lg"
55
56
  }) {
56
57
  return /*#__PURE__*/React.createElement(material.AppBar, {
57
58
  position: "relative"
58
59
  }, /*#__PURE__*/React.createElement(material.Container, {
59
- maxWidth: "xl"
60
+ maxWidth: maxWidth
60
61
  }, /*#__PURE__*/React.createElement(material.Toolbar, {
61
62
  disableGutters: true
62
63
  }, /*#__PURE__*/React.createElement(material.Grid, {
@@ -81,12 +82,20 @@ function Footer({
81
82
  cursor: "pointer",
82
83
  flexDirection: "column",
83
84
  alignItems: "center",
84
- justifyContent: "center"
85
+ justifyContent: "flex-start",
86
+ height: "100%"
85
87
  }
86
88
  }, /*#__PURE__*/React.createElement(material.Typography, {
87
89
  variant: "h6",
88
90
  color: "#ffffff"
89
- }, site_title), logo && /*#__PURE__*/React.createElement(material.Box, null, /*#__PURE__*/React.createElement(Image, {
91
+ }, site_title), logo && /*#__PURE__*/React.createElement(material.Box, {
92
+ sx: {
93
+ display: "flex",
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ height: "100%"
97
+ }
98
+ }, /*#__PURE__*/React.createElement(Image, {
90
99
  src: logo.url,
91
100
  width: logo.width,
92
101
  height: logo.height,
@@ -17,6 +17,7 @@ var CloseIcon = require('@mui/icons-material/Close');
17
17
  var MoreVertIcon = require('@mui/icons-material/MoreVert');
18
18
  var navigation = require('next/navigation');
19
19
  var PropTypes = require('prop-types');
20
+ var styles = require('@mui/material/styles');
20
21
 
21
22
  NavBar.propTypes = {
22
23
  site_title: PropTypes.string,
@@ -33,17 +34,21 @@ NavBar.propTypes = {
33
34
  tabs: PropTypes.arrayOf(PropTypes.shape({
34
35
  name: PropTypes.string.isRequired,
35
36
  url: PropTypes.string.isRequired
36
- }))
37
+ })),
38
+ maxWidth: PropTypes.string,
39
+ prominent: PropTypes.bool
37
40
  };
38
41
  function NavBar({
39
42
  site_title,
40
43
  logo,
41
44
  pages = [],
42
45
  tabs = [],
43
- maxWidth = "xl"
46
+ maxWidth = "lg",
47
+ minHeight = "80px"
44
48
  }) {
45
49
  // handleMobileMenu
46
50
 
51
+ styles.useTheme();
47
52
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
48
53
  const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
49
54
  const handleOpenMobileMenu = e => {
@@ -64,7 +69,10 @@ function NavBar({
64
69
  }, /*#__PURE__*/React.createElement(material.Toolbar, {
65
70
  disableGutters: true,
66
71
  sx: {
67
- py: 1
72
+ py: 1,
73
+ "@media all": {
74
+ minHeight: minHeight
75
+ }
68
76
  }
69
77
  }, /*#__PURE__*/React.createElement(Link, {
70
78
  href: "/",
@@ -47,12 +47,13 @@ function Footer({
47
47
  VAT_number,
48
48
  company_socials,
49
49
  disclaimer_link,
50
- privacypolicy_link
50
+ privacypolicy_link,
51
+ maxWidth = "lg"
51
52
  }) {
52
53
  return /*#__PURE__*/React.createElement(AppBar, {
53
54
  position: "relative"
54
55
  }, /*#__PURE__*/React.createElement(Container, {
55
- maxWidth: "xl"
56
+ maxWidth: maxWidth
56
57
  }, /*#__PURE__*/React.createElement(Toolbar, {
57
58
  disableGutters: true
58
59
  }, /*#__PURE__*/React.createElement(Grid, {
@@ -77,12 +78,20 @@ function Footer({
77
78
  cursor: "pointer",
78
79
  flexDirection: "column",
79
80
  alignItems: "center",
80
- justifyContent: "center"
81
+ justifyContent: "flex-start",
82
+ height: "100%"
81
83
  }
82
84
  }, /*#__PURE__*/React.createElement(Typography, {
83
85
  variant: "h6",
84
86
  color: "#ffffff"
85
- }, site_title), logo && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Image, {
87
+ }, site_title), logo && /*#__PURE__*/React.createElement(Box, {
88
+ sx: {
89
+ display: "flex",
90
+ alignItems: "center",
91
+ justifyContent: "center",
92
+ height: "100%"
93
+ }
94
+ }, /*#__PURE__*/React.createElement(Image, {
86
95
  src: logo.url,
87
96
  width: logo.width,
88
97
  height: logo.height,
@@ -13,6 +13,7 @@ import CloseIcon from '@mui/icons-material/Close';
13
13
  import MoreVertIcon from '@mui/icons-material/MoreVert';
14
14
  import { useRouter } from 'next/navigation';
15
15
  import PropTypes from 'prop-types';
16
+ import { useTheme } from '@mui/material/styles';
16
17
 
17
18
  NavBar.propTypes = {
18
19
  site_title: PropTypes.string,
@@ -29,17 +30,21 @@ NavBar.propTypes = {
29
30
  tabs: PropTypes.arrayOf(PropTypes.shape({
30
31
  name: PropTypes.string.isRequired,
31
32
  url: PropTypes.string.isRequired
32
- }))
33
+ })),
34
+ maxWidth: PropTypes.string,
35
+ prominent: PropTypes.bool
33
36
  };
34
37
  function NavBar({
35
38
  site_title,
36
39
  logo,
37
40
  pages = [],
38
41
  tabs = [],
39
- maxWidth = "xl"
42
+ maxWidth = "lg",
43
+ minHeight = "80px"
40
44
  }) {
41
45
  // handleMobileMenu
42
46
 
47
+ useTheme();
43
48
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
44
49
  const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
45
50
  const handleOpenMobileMenu = e => {
@@ -60,7 +65,10 @@ function NavBar({
60
65
  }, /*#__PURE__*/React.createElement(Toolbar, {
61
66
  disableGutters: true,
62
67
  sx: {
63
- py: 1
68
+ py: 1,
69
+ "@media all": {
70
+ minHeight: minHeight
71
+ }
64
72
  }
65
73
  }, /*#__PURE__*/React.createElement(Link, {
66
74
  href: "/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,6 +44,7 @@
44
44
  "@storybook/addon-interactions": "^7.6.7",
45
45
  "@storybook/addon-links": "^7.6.7",
46
46
  "@storybook/addon-onboarding": "^1.0.10",
47
+ "@storybook/addon-themes": "^7.6.17",
47
48
  "@storybook/blocks": "^7.6.7",
48
49
  "@storybook/nextjs": "^7.6.16",
49
50
  "@storybook/react": "^7.6.7",
@@ -76,6 +77,8 @@
76
77
  "validator": "^13.11.0"
77
78
  },
78
79
  "dependencies": {
80
+ "@fontsource/material-icons": "^5.0.15",
81
+ "@fontsource/roboto": "^5.0.12",
79
82
  "next-router-mock": "^0.9.12",
80
83
  "react": "^18.2.0",
81
84
  "react-dnd": "^16.0.1",
@@ -59,10 +59,11 @@ function Footer({
59
59
  company_socials,
60
60
  disclaimer_link,
61
61
  privacypolicy_link,
62
+ maxWidth = "lg",
62
63
  }) {
63
64
  return (
64
65
  <AppBar position="relative">
65
- <Container maxWidth="xl">
66
+ <Container maxWidth={maxWidth}>
66
67
  <Toolbar disableGutters>
67
68
  <Grid container sx={{ p: 2 }} spacing={2}>
68
69
  <Grid item xs={12} sm={4} align="center">
@@ -73,14 +74,22 @@ function Footer({
73
74
  cursor: "pointer",
74
75
  flexDirection: "column",
75
76
  alignItems: "center",
76
- justifyContent: "center",
77
+ justifyContent: "flex-start",
78
+ height: "100%",
77
79
  }}
78
80
  >
79
81
  <Typography variant="h6" color="#ffffff">
80
82
  {site_title}
81
83
  </Typography>
82
84
  {logo && (
83
- <Box>
85
+ <Box
86
+ sx={{
87
+ display: "flex",
88
+ alignItems: "center",
89
+ justifyContent: "center",
90
+ height: "100%",
91
+ }}
92
+ >
84
93
  <Image
85
94
  src={logo.url}
86
95
  width={logo.width}
@@ -25,6 +25,7 @@ import MoreVertIcon from "@mui/icons-material/MoreVert";
25
25
  import { useRouter } from "next/navigation";
26
26
 
27
27
  import PropTypes from "prop-types";
28
+ import { useTheme } from "@mui/material/styles";
28
29
 
29
30
  NavBar.propTypes = {
30
31
  site_title: PropTypes.string,
@@ -46,11 +47,22 @@ NavBar.propTypes = {
46
47
  url: PropTypes.string.isRequired,
47
48
  })
48
49
  ),
50
+ maxWidth: PropTypes.string,
51
+ prominent: PropTypes.bool,
49
52
  };
50
53
 
51
- function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
54
+ function NavBar({
55
+ site_title,
56
+ logo,
57
+ pages = [],
58
+ tabs = [],
59
+ maxWidth = "lg",
60
+ minHeight = "80px",
61
+ }) {
52
62
  // handleMobileMenu
53
63
 
64
+ const theme = useTheme();
65
+
54
66
  const [mobileNavOpen, setMobileNavOpen] = React.useState(false);
55
67
 
56
68
  const [currentTab, setCurrentTab] = React.useState(tabs[0]?.name || "");
@@ -74,7 +86,15 @@ function NavBar({ site_title, logo, pages = [], tabs = [], maxWidth = "xl" }) {
74
86
  return (
75
87
  <AppBar position="sticky">
76
88
  <Container maxWidth={maxWidth}>
77
- <Toolbar disableGutters sx={{ py: 1 }}>
89
+ <Toolbar
90
+ disableGutters
91
+ sx={{
92
+ py: 1,
93
+ "@media all": {
94
+ minHeight: minHeight,
95
+ },
96
+ }}
97
+ >
78
98
  {/* logo and site title for big screens */}
79
99
  <Link href="/" style={{ textDecoration: "none", color: "unset" }}>
80
100
  <Box
@@ -2,6 +2,7 @@ import NavBar from "../components/NavBar";
2
2
  import React from "react";
3
3
  import thumbnail from "../../public/placeholders/thumbnail_100X100.png";
4
4
  import logoText from "../../public/logo_text.png";
5
+ import { useTheme } from "@mui/material";
5
6
 
6
7
  export default {
7
8
  title: "UMWD/NavBar",
@@ -11,6 +12,7 @@ export default {
11
12
 
12
13
  const Template = ({ ...args }) => {
13
14
  console.log(thumbnail);
15
+
14
16
  return <NavBar {...args} />;
15
17
  };
16
18
 
@@ -93,4 +95,6 @@ AMH.args = {
93
95
  action: () => console.log("Contact"),
94
96
  },
95
97
  ],
98
+ maxWidth: "lg",
99
+ minHeight: "100px",
96
100
  };
@@ -0,0 +1,203 @@
1
+ import { createTheme } from "@mui/material/styles";
2
+ import { Roboto } from "next/font/google";
3
+ import { Montserrat } from "next/font/google";
4
+
5
+ const roboto = Roboto({
6
+ weight: ["100", "300", "400", "500", "700"],
7
+ subsets: ["latin"],
8
+ display: "swap",
9
+ });
10
+
11
+ const montserrat = Montserrat({
12
+ weight: ["100", "200", "300", "400", "500", "600", "700", "800", "900"],
13
+ subsets: ["latin"],
14
+ display: "swap",
15
+ });
16
+
17
+ export const darkTheme = createTheme({
18
+ palette: {
19
+ type: "dark",
20
+ primary: {
21
+ main: "#335e53",
22
+ light: "#457f70",
23
+ dark: "#213d36",
24
+ },
25
+ secondary: {
26
+ main: "#DD1805",
27
+ light: "#fa4736",
28
+ dark: "#b71404",
29
+ },
30
+ background: {
31
+ paper: "#000606",
32
+ default: "#000D06",
33
+ },
34
+ text: {
35
+ primary: "#fff",
36
+ secondary: "rgba(255, 255, 255, 0.7)",
37
+ disabled: "rgba(255, 255, 255, 0.5)",
38
+ hint: "rgba(255, 255, 255, 0.5)",
39
+ },
40
+ },
41
+ typography: {
42
+ fontFamily: roboto.style.fontFamily,
43
+ fontSize: 14,
44
+ h1: {
45
+ fontFamily: montserrat.style.fontFamily,
46
+ },
47
+ h2: {
48
+ fontFamily: montserrat.style.fontFamily,
49
+ },
50
+ h3: {
51
+ fontFamily: montserrat.style.fontFamily,
52
+ },
53
+ h4: {
54
+ fontFamily: montserrat.style.fontFamily,
55
+ },
56
+ h5: {
57
+ fontFamily: montserrat.style.fontFamily,
58
+ },
59
+ h6: {
60
+ fontFamily: montserrat.style.fontFamily,
61
+ },
62
+ subtitle1: {
63
+ fontFamily: roboto.style.fontFamily,
64
+ fontSize: "1.2rem",
65
+ lineHeight: 1.6,
66
+ },
67
+ subtitle2: {
68
+ fontFamily: roboto.style.fontFamily,
69
+ },
70
+ body1: {
71
+ fontFamily: roboto.style.fontFamily,
72
+ fontSize: "1.1rem",
73
+ lineHeight: 1.4,
74
+ },
75
+ body2: {
76
+ fontFamily: roboto.style.fontFamily,
77
+ fontSize: "1rem",
78
+ },
79
+ button: {
80
+ fontFamily: roboto.style.fontFamily,
81
+ },
82
+ caption: {
83
+ fontFamily: roboto.style.fontFamily,
84
+ },
85
+ overline: {
86
+ fontFamily: roboto.style.fontFamily,
87
+ },
88
+ },
89
+ components: {
90
+ MuiCssBaseline: {
91
+ styleOverrides: {
92
+ "*::-webkit-scrollbar": {
93
+ width: "0.8em",
94
+ },
95
+ "*::-webkit-scrollbar-track": {
96
+ "-webkit-box-shadow": "inset 0 0 6px rgba(0,0,0,0.00)",
97
+ backgroundColor: "#000606",
98
+ },
99
+ "*::-webkit-scrollbar-thumb": {
100
+ backgroundColor: "#DD1805",
101
+ outline: "1px solid slategrey",
102
+ },
103
+ },
104
+ },
105
+ },
106
+ }); // Dark theme
107
+
108
+ export const lightTheme = createTheme({
109
+ palette: {
110
+ type: "light",
111
+ primary: {
112
+ main: "#335e53",
113
+ light: "#457f70",
114
+ dark: "#213d36",
115
+ },
116
+ secondary: {
117
+ main: "#DD1805",
118
+ light: "#fa4736",
119
+ dark: "#b71404",
120
+ },
121
+ background: {
122
+ paper: "#a5c5ba",
123
+ default: "#d0dcd8",
124
+ },
125
+ text: {
126
+ primary: "rgba(0, 0, 0, 0.87)",
127
+ secondary: "rgba(0, 0, 0, 0.54)",
128
+ disabled: "rgba(0, 0, 0, 0.38)",
129
+ hint: "rgba(0, 0, 0, 0.38)",
130
+ },
131
+ },
132
+ typography: {
133
+ h1: {
134
+ fontFamily: "Montserrat",
135
+ fontSize: "84px",
136
+ },
137
+ h2: {
138
+ fontFamily: "Montserrat",
139
+ fontSize: "53px",
140
+ },
141
+ h3: {
142
+ fontFamily: "Montserrat",
143
+ fontSize: "42px",
144
+ },
145
+ h4: {
146
+ fontFamily: "Montserrat",
147
+ fontSize: "30px",
148
+ },
149
+ h5: {
150
+ fontFamily: "Montserrat",
151
+ fontSize: "21px",
152
+ },
153
+ h6: {
154
+ fontFamily: "Montserrat",
155
+ fontSize: "17px",
156
+ },
157
+ fontFamily: "Roboto",
158
+ fontSize: 14,
159
+ subtitle1: {
160
+ fontFamily: "Roboto",
161
+ fontSize: "1.2rem",
162
+ lineHeight: 1.6,
163
+ },
164
+ subtitle2: {
165
+ fontFamily: "Roboto",
166
+ },
167
+ body1: {
168
+ fontFamily: "Roboto",
169
+ fontSize: "1.1rem",
170
+ lineHeight: 1.4,
171
+ },
172
+ body2: {
173
+ fontFamily: "Roboto",
174
+ fontSize: "1rem",
175
+ },
176
+ button: {
177
+ fontFamily: "Roboto",
178
+ },
179
+ caption: {
180
+ fontFamily: "Roboto",
181
+ },
182
+ overline: {
183
+ fontFamily: "Roboto",
184
+ },
185
+ },
186
+ components: {
187
+ MuiCssBaseline: {
188
+ styleOverrides: {
189
+ "*::-webkit-scrollbar": {
190
+ width: "0.8em",
191
+ },
192
+ "*::-webkit-scrollbar-track": {
193
+ "-webkit-box-shadow": "inset 0 0 6px rgba(0,0,0,0.00)",
194
+ backgroundColor: "#a5c5ba",
195
+ },
196
+ "*::-webkit-scrollbar-thumb": {
197
+ backgroundColor: "#DD1805",
198
+ outline: "1px solid slategrey",
199
+ },
200
+ },
201
+ },
202
+ },
203
+ }); // Light theme