@openstack_dev/gatsby-theme-marketing-oif-core 1.0.7 → 1.0.9
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/gatsby-config.js +3 -4
- package/gatsby-ssr.js +6 -31
- package/package.json +3 -1
- package/src/components/Layout.js +21 -14
- package/src/components/Navbar/index.js +25 -19
- package/src/components/Navbar/index.module.scss +1 -0
- package/src/components/Seo.js +1 -1
- package/src/content/site-settings/index.json +1 -1
- package/src/state/ReduxWrapper.js +1 -12
- package/src/state/store.js +1 -3
- package/src/utils/createEmotionCache.js +5 -0
- package/src/state/storage.js +0 -21
package/gatsby-config.js
CHANGED
|
@@ -17,8 +17,6 @@ try {
|
|
|
17
17
|
console.log("Falling back to default site settings.");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
console.log("loaded siteSettings on gatsby config ...", siteSettings);
|
|
21
|
-
|
|
22
20
|
const title = siteSettings?.siteMetadata?.title || process.env.GATSBY_METADATA_TITLE;
|
|
23
21
|
const description = siteSettings?.siteMetadata?.description
|
|
24
22
|
|| process.env.GATSBY_METADATA_DESCRIPTION;
|
|
@@ -217,12 +215,13 @@ const plugins = [
|
|
|
217
215
|
"gatsby-plugin-netlify", // make sure to keep it last in the array
|
|
218
216
|
];
|
|
219
217
|
|
|
220
|
-
console.log(`title ${title} description ${description}`);
|
|
221
|
-
|
|
222
218
|
module.exports = {
|
|
223
219
|
siteMetadata: {
|
|
224
220
|
title,
|
|
225
221
|
description,
|
|
226
222
|
},
|
|
227
223
|
plugins,
|
|
224
|
+
flags: {
|
|
225
|
+
DEV_SSR: true,
|
|
226
|
+
},
|
|
228
227
|
};
|
package/gatsby-ssr.js
CHANGED
|
@@ -1,50 +1,25 @@
|
|
|
1
|
-
import * as ReactDOMServer from "react-dom/server";
|
|
2
1
|
import { JSDOM } from "jsdom";
|
|
3
2
|
import { XMLHttpRequest } from "xmlhttprequest";
|
|
4
|
-
import { ThemeProvider } from "@mui/material/styles";
|
|
5
|
-
import CssBaseline from "@mui/material/CssBaseline";
|
|
6
|
-
import theme from "./src/theme";
|
|
7
3
|
import ReduxWrapper from "./src/state/ReduxWrapper";
|
|
8
4
|
import { HeadComponents } from "./src/components/head-components";
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
setHtmlAttributes,
|
|
13
|
-
setHeadComponents,
|
|
14
|
-
setPreBodyComponents,
|
|
15
|
-
setPostBodyComponents,
|
|
16
|
-
}, pluginOptions) => {
|
|
17
|
-
if (process.env.NODE_ENV === `production`) {
|
|
6
|
+
export const onRenderBody = ({ setHeadComponents }) => {
|
|
7
|
+
if (process.env.NODE_ENV === "production") {
|
|
18
8
|
setHeadComponents(HeadComponents);
|
|
19
9
|
}
|
|
20
10
|
};
|
|
21
11
|
|
|
22
|
-
export const replaceRenderer = ({
|
|
23
|
-
bodyComponent,
|
|
24
|
-
setHeadComponents,
|
|
25
|
-
replaceBodyHTMLString,
|
|
26
|
-
}) => {
|
|
27
|
-
|
|
28
|
-
const html = ReactDOMServer.renderToString(
|
|
29
|
-
<ThemeProvider theme={theme}>
|
|
30
|
-
<CssBaseline />
|
|
31
|
-
{bodyComponent}
|
|
32
|
-
</ThemeProvider>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
replaceBodyHTMLString(html);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
12
|
export const wrapRootElement = ReduxWrapper;
|
|
39
13
|
|
|
40
14
|
// build enabler polyfills
|
|
41
15
|
global.dom = new JSDOM("...");
|
|
42
|
-
global.window = dom.window;
|
|
43
|
-
global.document = dom.window.document;
|
|
16
|
+
global.window = global.dom.window;
|
|
17
|
+
global.document = global.dom.window.document;
|
|
44
18
|
global.navigator = global.window.navigator;
|
|
45
19
|
global.window.matchMedia = () => ({
|
|
46
20
|
matches: false,
|
|
47
21
|
addListener: () => {},
|
|
48
|
-
removeListener: () => {}
|
|
22
|
+
removeListener: () => {},
|
|
49
23
|
});
|
|
24
|
+
|
|
50
25
|
global.XMLHttpRequest = XMLHttpRequest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openstack_dev/gatsby-theme-marketing-oif-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Base theme for Marketing Sites",
|
|
5
5
|
"author": "smarcet",
|
|
6
6
|
"keywords": [
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"**/*": "prettier --write --ignore-unknown"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@emotion/cache": "^11.11.0",
|
|
26
|
+
"@emotion/react": "^11.11.4",
|
|
25
27
|
"@fortawesome/fontawesome-free": "^6.5.2",
|
|
26
28
|
"@mui/icons-material": "^5.15.15",
|
|
27
29
|
"@mui/material": "^5.15.15",
|
package/src/components/Layout.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import CssBaseline from "@mui/material/CssBaseline";
|
|
4
|
+
import { CacheProvider } from "@emotion/react";
|
|
4
5
|
import { ThemeProvider } from "@mui/material/styles";
|
|
5
6
|
import Footer from "./Footer";
|
|
6
7
|
import SponsoredProjectsNav from "./SponsoredProjectsNav";
|
|
@@ -10,24 +11,30 @@ import Header from "./Header";
|
|
|
10
11
|
import Navbar from "./Navbar";
|
|
11
12
|
import theme from "../theme";
|
|
12
13
|
|
|
14
|
+
import createEmotionCache from "../utils/createEmotionCache";
|
|
15
|
+
|
|
16
|
+
const cache = createEmotionCache();
|
|
17
|
+
|
|
13
18
|
function Layout({ children }) {
|
|
14
19
|
return (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
<SponsoredProjectsNav />
|
|
19
|
-
<Navbar />
|
|
20
|
+
<CacheProvider value={cache}>
|
|
21
|
+
<ThemeProvider theme={theme}>
|
|
22
|
+
<CssBaseline />
|
|
20
23
|
<div>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
<SponsoredProjectsNav />
|
|
25
|
+
<Navbar />
|
|
26
|
+
<div>
|
|
27
|
+
<Header />
|
|
28
|
+
<AnnouncementBanner />
|
|
29
|
+
<main id="content-wrapper">
|
|
30
|
+
{children}
|
|
31
|
+
<SubscribeForm />
|
|
32
|
+
</main>
|
|
33
|
+
<Footer />
|
|
34
|
+
</div>
|
|
28
35
|
</div>
|
|
29
|
-
</
|
|
30
|
-
</
|
|
36
|
+
</ThemeProvider>
|
|
37
|
+
</CacheProvider>
|
|
31
38
|
);
|
|
32
39
|
}
|
|
33
40
|
|
|
@@ -15,6 +15,7 @@ import AddIcon from "@mui/icons-material/Add";
|
|
|
15
15
|
import RemoveIcon from "@mui/icons-material/Remove";
|
|
16
16
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
17
17
|
import Button from "@mui/material/Button";
|
|
18
|
+
import Link from "../Link";
|
|
18
19
|
|
|
19
20
|
import navbarContent from "../../content/navbar/index.json";
|
|
20
21
|
|
|
@@ -76,7 +77,6 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
76
77
|
<nav role="navigation">
|
|
77
78
|
<Script
|
|
78
79
|
src={`${getEnvVariable(SEARCH_WIDGET_BASE_URL)}/widget/embed.min.js`}
|
|
79
|
-
onLoad={() => console.log("Script loaded")}
|
|
80
80
|
/>
|
|
81
81
|
<AppBar
|
|
82
82
|
position="static"
|
|
@@ -142,18 +142,20 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
142
142
|
<Box
|
|
143
143
|
sx={{
|
|
144
144
|
flexGrow: 1,
|
|
145
|
-
display: {
|
|
145
|
+
display: {
|
|
146
|
+
xs: "none",
|
|
147
|
+
md: isSearchBarOpen ? "none" : "flex",
|
|
148
|
+
},
|
|
146
149
|
justifyContent: "flex-end",
|
|
147
150
|
}}
|
|
148
151
|
>
|
|
149
152
|
{navbarContent.items.map(
|
|
150
153
|
(item) => item.display && (
|
|
151
|
-
<
|
|
154
|
+
<Link
|
|
152
155
|
className={styles.navbarOption}
|
|
153
156
|
key={item.title}
|
|
154
157
|
sx={{ my: 2, display: "block" }}
|
|
155
|
-
|
|
156
|
-
onClick={() => handleNavigation(item.link)}
|
|
158
|
+
href={item.link}
|
|
157
159
|
>
|
|
158
160
|
{item.items?.length > 0 ? (
|
|
159
161
|
<>
|
|
@@ -161,7 +163,10 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
161
163
|
<ArrowDropDownIcon className={styles.arrowDownIcon} />
|
|
162
164
|
<Box className={styles.dropDownMenu}>
|
|
163
165
|
{item.items.map((subItem) => (!subItem.title && !subItem.link ? (
|
|
164
|
-
<div
|
|
166
|
+
<div
|
|
167
|
+
className={styles.divider}
|
|
168
|
+
key={subItem.title}
|
|
169
|
+
/>
|
|
165
170
|
) : (
|
|
166
171
|
<Button
|
|
167
172
|
className={styles.dropdownMenuOption}
|
|
@@ -178,7 +183,7 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
178
183
|
) : (
|
|
179
184
|
item.title
|
|
180
185
|
)}
|
|
181
|
-
</
|
|
186
|
+
</Link>
|
|
182
187
|
),
|
|
183
188
|
)}
|
|
184
189
|
</Box>
|
|
@@ -194,10 +199,9 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
194
199
|
marginLeft: "auto",
|
|
195
200
|
}}
|
|
196
201
|
>
|
|
197
|
-
<
|
|
202
|
+
<Box
|
|
198
203
|
className={`${styles.navbarOption}`}
|
|
199
204
|
sx={{ my: 2, display: "block" }}
|
|
200
|
-
disableRipple
|
|
201
205
|
>
|
|
202
206
|
My Account
|
|
203
207
|
<ArrowDropDownIcon className={styles.arrowDownIcon} />
|
|
@@ -232,7 +236,7 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
232
236
|
Log out
|
|
233
237
|
</Button>
|
|
234
238
|
</Box>
|
|
235
|
-
</
|
|
239
|
+
</Box>
|
|
236
240
|
</Box>
|
|
237
241
|
) : (
|
|
238
242
|
<Box
|
|
@@ -246,10 +250,9 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
246
250
|
marginLeft: "auto",
|
|
247
251
|
}}
|
|
248
252
|
>
|
|
249
|
-
<
|
|
253
|
+
<Box
|
|
250
254
|
className={`${styles.navbarOption} ${styles.join}`}
|
|
251
255
|
sx={{ my: 2, display: "block" }}
|
|
252
|
-
disableRipple
|
|
253
256
|
>
|
|
254
257
|
Join
|
|
255
258
|
<ArrowDropDownIcon className={styles.arrowDownIcon} />
|
|
@@ -279,7 +282,7 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
279
282
|
More about the Foundation
|
|
280
283
|
</Button>
|
|
281
284
|
</Box>
|
|
282
|
-
</
|
|
285
|
+
</Box>
|
|
283
286
|
<Button
|
|
284
287
|
className={`${styles.navbarOption} ${styles.login}`}
|
|
285
288
|
onClick={() => doLogin("/")}
|
|
@@ -332,11 +335,14 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
332
335
|
{item.items?.length > 0 && item.title === navbarMenu && (
|
|
333
336
|
<Box className={styles.mobileDropdownMenu}>
|
|
334
337
|
{item.items.map((subItem) => (!subItem.title && !subItem.link ? (
|
|
335
|
-
<div
|
|
338
|
+
<div
|
|
339
|
+
className={styles.divider}
|
|
340
|
+
key={subItem.title}
|
|
341
|
+
/>
|
|
336
342
|
) : (
|
|
337
343
|
<Button
|
|
338
344
|
className={styles.mobileDropdownOption}
|
|
339
|
-
key={subItem.title}
|
|
345
|
+
key={`${subItem.title}-mobile`}
|
|
340
346
|
onClick={() => handleNavigation(subItem.link)}
|
|
341
347
|
sx={{ display: "block" }}
|
|
342
348
|
disableRipple
|
|
@@ -399,10 +405,9 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
399
405
|
</>
|
|
400
406
|
) : (
|
|
401
407
|
<Box>
|
|
402
|
-
<
|
|
408
|
+
<Box
|
|
403
409
|
className={`${styles.navbarOption} ${styles.join}`}
|
|
404
410
|
sx={{ my: 2, display: "block" }}
|
|
405
|
-
disableRipple
|
|
406
411
|
>
|
|
407
412
|
Join
|
|
408
413
|
<ArrowDropDownIcon className={styles.arrowDownIcon} />
|
|
@@ -432,7 +437,7 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
432
437
|
More about the Foundation
|
|
433
438
|
</Button>
|
|
434
439
|
</Box>
|
|
435
|
-
</
|
|
440
|
+
</Box>
|
|
436
441
|
<Button
|
|
437
442
|
className={`${styles.navbarOption} ${styles.login}`}
|
|
438
443
|
onClick={() => doLogin("/")}
|
|
@@ -453,7 +458,8 @@ function Navbar({ isLoggedUser, member }) {
|
|
|
453
458
|
|
|
454
459
|
Navbar.propTypes = {
|
|
455
460
|
isLoggedUser: PropTypes.bool.isRequired,
|
|
456
|
-
member: PropTypes.object.
|
|
461
|
+
member: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf([null])])
|
|
462
|
+
.isRequired,
|
|
457
463
|
};
|
|
458
464
|
|
|
459
465
|
const mapStateToProps = ({ loggedUserState }) => ({
|
package/src/components/Seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "staticJsonFilesBuildTime": [], "lastBuild":
|
|
1
|
+
{ "staticJsonFilesBuildTime": [], "lastBuild": 1713949648791 }
|
|
@@ -3,21 +3,10 @@ import { Provider } from "react-redux";
|
|
|
3
3
|
import { PersistGate } from "redux-persist/integration/react";
|
|
4
4
|
import { store, persistor } from "./store";
|
|
5
5
|
|
|
6
|
-
const onBeforeLift = () => {
|
|
7
|
-
const params = new URLSearchParams(window.location.search);
|
|
8
|
-
const flush = params.has("flushState");
|
|
9
|
-
|
|
10
|
-
if (flush) {
|
|
11
|
-
// store.dispatch({ type: RESET_STATE, payload: null });
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
6
|
function ReduxWrapper({ element }) {
|
|
16
7
|
return (
|
|
17
8
|
<Provider store={store}>
|
|
18
|
-
<PersistGate
|
|
19
|
-
{() => element}
|
|
20
|
-
</PersistGate>
|
|
9
|
+
<PersistGate persistor={persistor}>{() => element}</PersistGate>
|
|
21
10
|
</Provider>
|
|
22
11
|
);
|
|
23
12
|
}
|
package/src/state/store.js
CHANGED
|
@@ -21,13 +21,11 @@ const states = {
|
|
|
21
21
|
loggedUserState: reducers.loggedUserReducer,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const appendLoggedUser = () => (next) => (action) => next(action);
|
|
25
|
-
|
|
26
24
|
const composeEnhancers = typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
27
25
|
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
28
26
|
: compose;
|
|
29
27
|
|
|
30
|
-
const enhancer = composeEnhancers(applyMiddleware(
|
|
28
|
+
const enhancer = composeEnhancers(applyMiddleware(thunk));
|
|
31
29
|
|
|
32
30
|
// Create store with persistor
|
|
33
31
|
export const { store, persistor } = (() => {
|
package/src/state/storage.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import createWebStorage from "redux-persist/lib/storage/createWebStorage";
|
|
2
|
-
// create a mock storage for SSR
|
|
3
|
-
const createNoopStorage = () => {
|
|
4
|
-
return {
|
|
5
|
-
getItem(_key) {
|
|
6
|
-
return Promise.resolve(null);
|
|
7
|
-
},
|
|
8
|
-
setItem(_key, value) {
|
|
9
|
-
return Promise.resolve(value);
|
|
10
|
-
},
|
|
11
|
-
removeItem(_key) {
|
|
12
|
-
return Promise.resolve();
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// and set the proper storege depending if we are in browser side or SSR side
|
|
18
|
-
// because you cannot create the local storage in Node.js
|
|
19
|
-
const storage = typeof window !== "undefined" ? createWebStorage("local") : createNoopStorage();
|
|
20
|
-
|
|
21
|
-
export default storage;
|