WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit aac8da5

Browse files
authored
Merge pull request #7231 from layer5io/leecalcote/chore/move-static-assets
leecalcote/chore/move static assets
2 parents 252fbe1 + 6b846bb commit aac8da5

File tree

20 files changed

+96
-29
lines changed

20 files changed

+96
-29
lines changed

gatsby-node.js

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ if (process.env.CI === "true") {
3434
if (page.path !== oldPage.path) {
3535
// Replace new page with old page
3636
deletePage(oldPage);
37+
page.slices = { ...DEFAULT_SLICES, ...(page.slices || {}) };
3738
createPage(page);
3839

3940
createRedirect({
@@ -49,16 +50,52 @@ if (process.env.CI === "true") {
4950

5051
const { loadRedirects } = require("./src/utils/redirects.js");
5152

53+
const DEFAULT_SLICES = {
54+
"site-header": "site-header",
55+
"site-footer": "site-footer",
56+
"cta-bottom": "cta-bottom",
57+
"cta-fullwidth": "cta-fullwidth",
58+
"cta-imageonly": "cta-imageonly",
59+
};
60+
5261
exports.createPages = async ({ actions, graphql, reporter }) => {
53-
const { createRedirect } = actions;
62+
const { createRedirect, createSlice } = actions;
5463
const redirects = loadRedirects();
5564
redirects.forEach(redirect => createRedirect(redirect)); // Handles all hardcoded ones dynamically
5665
// Create Pages
5766
const { createPage } = actions;
5867

68+
createSlice({
69+
id: "site-header",
70+
component: path.resolve("./src/slices/site-header.js"),
71+
});
72+
73+
createSlice({
74+
id: "site-footer",
75+
component: path.resolve("./src/slices/site-footer.js"),
76+
});
77+
78+
createSlice({
79+
id: "cta-bottom",
80+
component: path.resolve("./src/slices/cta-bottom.js"),
81+
});
82+
83+
createSlice({
84+
id: "cta-fullwidth",
85+
component: path.resolve("./src/slices/cta-fullwidth.js"),
86+
});
87+
88+
createSlice({
89+
id: "cta-imageonly",
90+
component: path.resolve("./src/slices/cta-imageonly.js"),
91+
});
92+
5993
const envCreatePage = (props) => {
94+
const pageConfig = { ...props };
95+
pageConfig.slices = { ...DEFAULT_SLICES, ...(pageConfig.slices || {}) };
96+
6097
if (process.env.CI === "true") {
61-
const { path, matchPath, ...rest } = props;
98+
const { path, matchPath, ...rest } = pageConfig;
6299

63100
createRedirect({
64101
fromPath: `/${path}/`,
@@ -73,7 +110,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
73110
...rest,
74111
});
75112
}
76-
return createPage(props);
113+
return createPage(pageConfig);
77114
};
78115

79116
const blogPostTemplate = path.resolve("src/templates/blog-single.js");
@@ -510,7 +547,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
510547
});
511548

512549
const components = componentsData.map((component) => component.src.replace("/", ""));
513-
const createComponentPages = (createPage, components) => {
550+
const createComponentPages = (envCreatePage, components) => {
514551
const pageTypes = [
515552
{ suffix: "", file: "index.js" },
516553
{ suffix: "/guidance", file: "guidance.js" },
@@ -523,7 +560,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
523560
const componentPath = `./src/sections/Projects/Sistent/components/${name}/${file}`;
524561
if (fs.existsSync(path.resolve(componentPath))) {
525562
try {
526-
createPage({
563+
envCreatePage({
527564
path: pagePath,
528565
component: require.resolve(componentPath),
529566
});
@@ -537,7 +574,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
537574
});
538575
};
539576

540-
createComponentPages(createPage, components);
577+
createComponentPages(envCreatePage, components);
541578
};
542579

543580
// slug starts and ends with '/' so parts[0] and parts[-1] will be empty

root-wrapper.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from "react";
22
import { MDXProvider } from "@mdx-js/react";
33
import Code from "./src/components/CodeBlock";
4-
import CTA_ImageOnly from "./src/components/Call-To-Actions/CTA_ImageOnly";
5-
import CTA_FullWidth from "./src/components/Call-To-Actions/CTA_FullWidth";
6-
import CTA_Bottom from "./src/components/Call-To-Actions/CTA_Bottom";
4+
import { Slice } from "gatsby";
75
import { ContextWrapper } from "./context-wrapper";
86

97
// Custom image component for better CLS scores
@@ -41,9 +39,9 @@ const components = {
4139
}
4240
},
4341
img: OptimizedImage,
44-
CTA_ImageOnly,
45-
CTA_FullWidth,
46-
CTA_Bottom
42+
CTA_ImageOnly: (props) => <Slice alias="cta-imageonly" sliceContext={props} />, // slice to avoid page rebuilds on CTA tweaks
43+
CTA_FullWidth: (props) => <Slice alias="cta-fullwidth" sliceContext={props} />, // slice to avoid page rebuilds on CTA tweaks
44+
CTA_Bottom: (props) => <Slice alias="cta-bottom" sliceContext={props} />
4745
};
4846

4947
export const wrapRootElement = ({ element }) => (

src/assets/brand/bookmarks.pdf

-220 KB
Binary file not shown.

src/assets/brand/brand-guide.pdf

-6.67 MB
Binary file not shown.
-2.22 MB
Binary file not shown.
-22.3 MB
Binary file not shown.
-2.48 MB
Binary file not shown.

src/assets/video/meshery/meshmap/touch

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/layout.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,21 @@
99

1010
import React from "react";
1111
import PropTypes from "prop-types";
12+
import { Slice } from "gatsby";
1213
import ScrollToTopBtn from "./Scrolltotop-button";
13-
import Navigation from "../sections/General/Navigation";
14-
import Footer from "../sections/General/Footer";
1514
// import TopPromotionalBanner from "./TopPromotionalBanner";
1615
import { GlobalStyle } from "../sections/app.style";
17-
import CookieConsent from "./CookieConsent";
1816

1917
const Layout = ({ children }) => {
2018

2119
return (
2220
<>
2321
<GlobalStyle />
2422
{/* <TopPromotionalBanner /> */}
25-
<Navigation/>
26-
<CookieConsent />
23+
<Slice alias="site-header" />
2724
{children}
2825
<ScrollToTopBtn />
29-
<Footer location={children.props.location} />
26+
<Slice alias="site-footer" />
3027
</>
3128
);
3229
};

src/sections/Company/Brand/Brand-components/brand-guide.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import styled from "styled-components";
33
import Button from "../../../../reusecore/Button";
44
import BrandGuideImg from "../../../../assets/images/Brand-Guide/brand-guide.webp";
5-
import BrandGuidePDF from "../../../../assets/brand/brand-guide.pdf";
65

76
import { Row, Col } from "../../../../reusecore/Layout";
87
import { FiDownloadCloud } from "@react-icons/all-files/fi/FiDownloadCloud";
@@ -46,7 +45,7 @@ const BrandGuide = () => {
4645
<Row>
4746
<Col $xs={12}>
4847
<Row className="bookmarks">
49-
<Link to={BrandGuidePDF}>
48+
<Link to="/brand/brand-guide.pdf">
5049
<img className="bookmarks" src={BrandGuideImg} alt="Layer5 Brand Guide" />
5150
</Link>
5251
</Row>

0 commit comments

Comments
 (0)