@openstack_dev/gatsby-theme-marketing-oif-core 1.0.9 → 1.0.10
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-browser.js +2 -4
- package/gatsby-ssr.js +32 -1
- package/package.json +5 -1
- package/src/components/Layout.js +20 -21
- package/src/components/Navbar/index.js +1 -0
- package/src/components/Navbar/placeholder.js +20 -0
- package/src/content/site-settings/index.json +1 -1
- package/src/state/ReduxWrapper.js +13 -2
package/gatsby-browser.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReduxWrapperWithCacheProvider } from "./src/state/ReduxWrapper";
|
|
2
2
|
|
|
3
|
-
export const wrapRootElement =
|
|
4
|
-
|
|
5
|
-
export const onClientEntry = () => {};
|
|
3
|
+
export const wrapRootElement = ReduxWrapperWithCacheProvider;
|
package/gatsby-ssr.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { JSDOM } from "jsdom";
|
|
2
3
|
import { XMLHttpRequest } from "xmlhttprequest";
|
|
3
|
-
import
|
|
4
|
+
import { renderToString } from "react-dom/server";
|
|
5
|
+
import { CacheProvider } from "@emotion/react";
|
|
6
|
+
import createEmotionServer from "@emotion/server/create-instance";
|
|
7
|
+
import { ReduxWrapper } from "./src/state/ReduxWrapper";
|
|
4
8
|
import { HeadComponents } from "./src/components/head-components";
|
|
9
|
+
import createEmotionCache from "./src/utils/createEmotionCache";
|
|
5
10
|
|
|
6
11
|
export const onRenderBody = ({ setHeadComponents }) => {
|
|
7
12
|
if (process.env.NODE_ENV === "production") {
|
|
@@ -9,6 +14,32 @@ export const onRenderBody = ({ setHeadComponents }) => {
|
|
|
9
14
|
}
|
|
10
15
|
};
|
|
11
16
|
|
|
17
|
+
export const replaceRenderer = ({
|
|
18
|
+
bodyComponent,
|
|
19
|
+
setHeadComponents,
|
|
20
|
+
replaceBodyHTMLString,
|
|
21
|
+
}) => {
|
|
22
|
+
const cache = createEmotionCache();
|
|
23
|
+
const { extractCriticalToChunks } = createEmotionServer(cache);
|
|
24
|
+
|
|
25
|
+
const emotionStyles = extractCriticalToChunks(
|
|
26
|
+
renderToString(<CacheProvider value={cache}>{bodyComponent}</CacheProvider>),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
setHeadComponents(
|
|
30
|
+
emotionStyles.styles.map((style) => (
|
|
31
|
+
<style
|
|
32
|
+
data-emotion={`${style.key} ${style.ids.join(" ")}`}
|
|
33
|
+
key={style.key}
|
|
34
|
+
dangerouslySetInnerHTML={{ __html: style.css }}
|
|
35
|
+
/>
|
|
36
|
+
)),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// render the result from `extractCritical`
|
|
40
|
+
replaceBodyHTMLString(emotionStyles.html);
|
|
41
|
+
};
|
|
42
|
+
|
|
12
43
|
export const wrapRootElement = ReduxWrapper;
|
|
13
44
|
|
|
14
45
|
// build enabler polyfills
|
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.10",
|
|
4
4
|
"description": "Base theme for Marketing Sites",
|
|
5
5
|
"author": "smarcet",
|
|
6
6
|
"keywords": [
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@emotion/cache": "^11.11.0",
|
|
26
26
|
"@emotion/react": "^11.11.4",
|
|
27
|
+
"@emotion/server": "^11.11.0",
|
|
28
|
+
"@emotion/styled": "^11.11.5",
|
|
27
29
|
"@fortawesome/fontawesome-free": "^6.5.2",
|
|
30
|
+
"@loadable/component": "^5.16.4",
|
|
28
31
|
"@mui/icons-material": "^5.15.15",
|
|
29
32
|
"@mui/material": "^5.15.15",
|
|
30
33
|
"@ncwidgets/file-relation": "^0.8.0",
|
|
@@ -110,6 +113,7 @@
|
|
|
110
113
|
"react-iframe-comm": "^1.2.2",
|
|
111
114
|
"react-immutable-proptypes": "^2.2.0",
|
|
112
115
|
"react-laag": "^2.0.5",
|
|
116
|
+
"react-loadable-visibility": "^3.0.2",
|
|
113
117
|
"react-medium-image-zoom": "^4.3.5",
|
|
114
118
|
"react-redux": "^7.2.6",
|
|
115
119
|
"react-rte": "^0.16.3",
|
package/src/components/Layout.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
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";
|
|
5
4
|
import { ThemeProvider } from "@mui/material/styles";
|
|
5
|
+
import loadable from "@loadable/component";
|
|
6
6
|
import Footer from "./Footer";
|
|
7
7
|
import SponsoredProjectsNav from "./SponsoredProjectsNav";
|
|
8
8
|
import SubscribeForm from "./SubscribeForm";
|
|
9
9
|
import AnnouncementBanner from "./AnnouncementBanner";
|
|
10
10
|
import Header from "./Header";
|
|
11
|
-
import Navbar from "./Navbar";
|
|
12
11
|
import theme from "../theme";
|
|
12
|
+
import NavBarPlaceholder from "./Navbar/placeholder";
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const Navbar = loadable(() => import("./Navbar"), {
|
|
15
|
+
ssr: false,
|
|
16
|
+
fallback: <NavBarPlaceholder />,
|
|
17
|
+
});
|
|
17
18
|
|
|
18
19
|
function Layout({ children }) {
|
|
19
20
|
return (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
21
|
+
<ThemeProvider theme={theme}>
|
|
22
|
+
<CssBaseline />
|
|
23
|
+
<div>
|
|
24
|
+
<SponsoredProjectsNav />
|
|
25
|
+
<Navbar />
|
|
23
26
|
<div>
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<SubscribeForm />
|
|
32
|
-
</main>
|
|
33
|
-
<Footer />
|
|
34
|
-
</div>
|
|
27
|
+
<Header />
|
|
28
|
+
<AnnouncementBanner />
|
|
29
|
+
<main id="content-wrapper">
|
|
30
|
+
{children}
|
|
31
|
+
<SubscribeForm />
|
|
32
|
+
</main>
|
|
33
|
+
<Footer />
|
|
35
34
|
</div>
|
|
36
|
-
</
|
|
37
|
-
</
|
|
35
|
+
</div>
|
|
36
|
+
</ThemeProvider>
|
|
38
37
|
);
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import AppBar from "@mui/material/AppBar";
|
|
3
|
+
import { Container } from "@mui/material";
|
|
4
|
+
import styles from "./index.module.scss";
|
|
5
|
+
|
|
6
|
+
function NavBarPlaceholder() {
|
|
7
|
+
return (
|
|
8
|
+
<nav role="navigation">
|
|
9
|
+
<AppBar
|
|
10
|
+
position="static"
|
|
11
|
+
className={styles.navbar}
|
|
12
|
+
sx={{ backgroundColor: "#fff", boxShadow: "none" }}
|
|
13
|
+
>
|
|
14
|
+
<Container maxWidth="xl" />
|
|
15
|
+
</AppBar>
|
|
16
|
+
</nav>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default NavBarPlaceholder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "staticJsonFilesBuildTime": [], "lastBuild":
|
|
1
|
+
{ "staticJsonFilesBuildTime": [], "lastBuild": 1713964554954 }
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
3
|
import { PersistGate } from "redux-persist/integration/react";
|
|
4
|
+
import { CacheProvider } from "@emotion/react";
|
|
4
5
|
import { store, persistor } from "./store";
|
|
6
|
+
import createEmotionCache from "../utils/createEmotionCache";
|
|
5
7
|
|
|
6
|
-
function ReduxWrapper({ element }) {
|
|
8
|
+
export function ReduxWrapper({ element }) {
|
|
7
9
|
return (
|
|
8
10
|
<Provider store={store}>
|
|
9
11
|
<PersistGate persistor={persistor}>{() => element}</PersistGate>
|
|
@@ -11,4 +13,13 @@ function ReduxWrapper({ element }) {
|
|
|
11
13
|
);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export
|
|
16
|
+
export function ReduxWrapperWithCacheProvider({ element }) {
|
|
17
|
+
const cache = createEmotionCache();
|
|
18
|
+
return (
|
|
19
|
+
<CacheProvider value={cache}>
|
|
20
|
+
<Provider store={store}>
|
|
21
|
+
<PersistGate persistor={persistor}>{() => element}</PersistGate>
|
|
22
|
+
</Provider>
|
|
23
|
+
</CacheProvider>
|
|
24
|
+
);
|
|
25
|
+
}
|