@openstack_dev/gatsby-theme-marketing-oif-core 1.0.29 → 1.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstack_dev/gatsby-theme-marketing-oif-core",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Base theme for Marketing Sites",
5
5
  "author": "smarcet",
6
6
  "keywords": [
@@ -15,7 +15,7 @@
15
15
  "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"{gatsby-*.js,src/**/*.js}\"",
16
16
  "prepare": "husky",
17
17
  "lint": "eslint src",
18
- "precommit": "npx lint-staged --diff=origin/main --verbose",
18
+ "precommit": "yarn lint-staged --verbose",
19
19
  "rewrite_rules": "NODE_ENV=development node redirection-rules.js"
20
20
  },
21
21
  "lint-staged": {
@@ -23,7 +23,9 @@
23
23
  "**/*": "prettier --write --ignore-unknown"
24
24
  },
25
25
  "dependencies": {
26
- "@babel/core": "^7.12.3",
26
+ "@babel/core": "^7.26.10",
27
+ "@babel/preset-env": "^7.26.9",
28
+ "@babel/preset-react": "^7.26.3",
27
29
  "@emotion/cache": "^11.11.0",
28
30
  "@emotion/react": "^11.11.4",
29
31
  "@emotion/server": "^11.11.0",
@@ -152,6 +154,8 @@
152
154
  "yup": "^0.32.11"
153
155
  },
154
156
  "devDependencies": {
157
+ "@babel/eslint-parser": "^7.27.0",
158
+ "babel-preset-gatsby": "^3.14.0",
155
159
  "eslint": "^7.32.0 || ^8.2.0",
156
160
  "eslint-config-airbnb": "^19.0.4",
157
161
  "eslint-config-prettier": "^9.1.0",
@@ -56,13 +56,32 @@ const buildRedirectionRules = () => {
56
56
  const hasSplat = redirect.from.endsWith("*");
57
57
  if (formerToml && tomlNodeExists(formerToml, NodeType.Route, redirect.from)) continue;
58
58
 
59
+ const httpRegExp = /^https?:\/\//;
60
+ const isAbsolute = httpRegExp.test(redirect.to);
61
+ const host = isAbsolute ? '' : redirectionHost;
62
+
63
+ // Status code logic correction:
64
+ // 200 for regular redirects (within the same site): for backward compatibility below v1.1.0
65
+ // 301 for absolute URLs (external redirects): permanent redirect
66
+ // If status is provided and is a valid number, has precedence over defaultStatus
67
+ const defaultStatus = isAbsolute ? 301 : 200;
68
+ const parsedStatus = parseInt(redirect.status, 10);
69
+ const status = !isNaN(parsedStatus) ? parsedStatus : defaultStatus;
70
+ const headers = [
71
+ `X-From = "netlify"`,
72
+ `X-Forwarded-Host = "${forwardedHost}"`,
73
+ ]
74
+ if (!isAbsolute) {
75
+ headers.unshift(`Authorization = "Basic ${authToken}"`);
76
+ }
77
+
59
78
  netlifyToml += `
60
79
  [[redirects]]
61
80
  from = "${redirect.from}"
62
- to = "${redirectionHost}${redirect.to}${hasSplat ? ":splat" : ""}"
63
- status = 200
81
+ to = "${host}${redirect.to}${hasSplat ? ":splat" : ""}"
82
+ status = ${status}
64
83
  force = true
65
- headers = {Authorization = "Basic ${authToken}", X-From = "netlify", X-Forwarded-Host = "${forwardedHost}"}\n`;
84
+ headers = {${headers.join(", ")}}\n`;
66
85
  }
67
86
 
68
87
  if (!appendMode) {
@@ -4,13 +4,14 @@ import siteSettings from "./siteSettings";
4
4
  import navbar from "./navbar";
5
5
  import footer from "./footer";
6
6
  import announcementBanner from "./announcementBanner";
7
+ import siteBanner from "./siteBanner";
7
8
 
8
9
  const configurationsCollection = {
9
10
  ...collectionDefaults({
10
11
  label: "Configurations",
11
- name: "configurations",
12
+ name: "configurations"
12
13
  }),
13
- files: [siteSettings, navbar, footer, announcementBanner],
14
+ files: [siteSettings, navbar, footer, announcementBanner, siteBanner]
14
15
  };
15
16
 
16
17
  export default configurationsCollection;
@@ -0,0 +1,32 @@
1
+ import { SITE_BANNER_FILE_PATH } from "@utils/filePath";
2
+ import { stringField, textField, booleanField } from "../../../fields";
3
+
4
+ const siteBanner = {
5
+ label: "Site Banner",
6
+ name: "site-banner",
7
+ file: SITE_BANNER_FILE_PATH,
8
+ fields: [
9
+ textField({
10
+ label: "Text",
11
+ name: "text",
12
+ required: true
13
+ }),
14
+ stringField({
15
+ label: "CTA Title",
16
+ name: "cta_title",
17
+ required: true
18
+ }),
19
+ stringField({
20
+ label: "CTA Link",
21
+ name: "cta_link",
22
+ required: true
23
+ }),
24
+ booleanField({
25
+ label: "Display",
26
+ name: "display",
27
+ required: false
28
+ })
29
+ ]
30
+ };
31
+
32
+ export default siteBanner;
@@ -0,0 +1,7 @@
1
+ module.exports = `
2
+ type SiteBannerJson implements Node {
3
+ text: String
4
+ cta_title: String
5
+ cta_link: String
6
+ }
7
+ `;
@@ -1,9 +1,11 @@
1
1
  const siteSettingsTypeDefs = require("./siteSettings/typeDefs");
2
2
  const footerTypeDefs = require("./footer/typeDefs");
3
3
  const announcementBannerTypeDefs = require("./announcementBanner/typeDefs");
4
+ const siteBannerTypeDefs = require("./siteBanner/typeDefs");
4
5
 
5
6
  module.exports = [
6
7
  siteSettingsTypeDefs,
7
8
  footerTypeDefs,
8
- announcementBannerTypeDefs
9
+ announcementBannerTypeDefs,
10
+ siteBannerTypeDefs
9
11
  ].join("");
@@ -1,11 +1,9 @@
1
1
  import configurationsCollection from "./collections/configurationsCollection";
2
2
 
3
3
  const CMS_BACKEND_REPO = process.env.GATSBY_CMS_BACKEND_REPO;
4
- const CMS_BACKEND_BRANCH = process.env.GATSBY_CMS_BACKEND_BRANCH || "main";
4
+ const CMS_BACKEND_BRANCH = process.env.GATSBY_CMS_BACKEND_BRANCH || "main";
5
5
 
6
- export const collections = [
7
- configurationsCollection,
8
- ];
6
+ export const collections = [configurationsCollection];
9
7
 
10
8
  const config = {
11
9
  backend: {
@@ -17,7 +15,7 @@ const config = {
17
15
  update: "Update {{collection}} “{{slug}}”",
18
16
  delete: "Delete {{collection}} “{{slug}}”",
19
17
  uploadMedia: "[skip ci] Upload “{{path}}”",
20
- deleteMedia: "[skip ci] Delete “{{path}}”",
18
+ deleteMedia: "[skip ci] Delete “{{path}}”"
21
19
  }
22
20
  },
23
21
  // It is not required to set `load_config_file` if the `config.yml` file is
@@ -25,7 +23,7 @@ const config = {
25
23
  load_config_file: false,
26
24
  media_folder: "static/img",
27
25
  public_folder: "/img",
28
- collections: collections
26
+ collections
29
27
  };
30
28
 
31
29
  if (!CMS_BACKEND_REPO || !CMS_BACKEND_BRANCH) {
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { useStaticQuery, graphql } from "gatsby";
3
+ import SiteBannerTemplate from "./template";
4
+
5
+ const siteBannerQuery = graphql`
6
+ query {
7
+ siteBannerJson {
8
+ text
9
+ cta_title
10
+ cta_link
11
+ display
12
+ }
13
+ }
14
+ `;
15
+
16
+ function SiteBanner() {
17
+ const { siteBannerJson: siteBannerContent } = useStaticQuery(siteBannerQuery);
18
+
19
+ return <SiteBannerTemplate data={siteBannerContent} />;
20
+ }
21
+
22
+ export default SiteBanner;
@@ -0,0 +1,69 @@
1
+ .siteBannerWrapper {
2
+ display: flex;
3
+ min-height: 40px;
4
+ position: relative;
5
+ left: 0;
6
+ z-index: 20;
7
+ background-color: #4d96c7;
8
+ color: #f0f9fe;
9
+ font-size: 14px;
10
+ line-height: 20px;
11
+ .siteBannerContainer {
12
+ display: flex;
13
+ flex-direction: row;
14
+ text-align: left;
15
+ align-items: center;
16
+ }
17
+ .bannerText {
18
+ display: inline;
19
+ font-size: 16px;
20
+ line-height: 22px;
21
+ letter-spacing: normal;
22
+ max-width: 734px;
23
+ color: white;
24
+ font-size: 12px;
25
+ font-family: "Open Sans", Helvetica, Arial, sans-serif;
26
+ -webkit-font-smoothing: none;
27
+ -moz-osx-font-smoothing: none;
28
+ text-rendering: auto;
29
+ @media (min-width: 991px) {
30
+ font-size: 16px;
31
+ }
32
+ }
33
+ .bannerButton {
34
+ margin-left: 20px;
35
+ border-radius: 5px;
36
+ border: 1px solid #2f729c;
37
+ padding: 2px 10px 3px;
38
+ background-color: #2f729c;
39
+ display: inline-block;
40
+ text-transform: uppercase;
41
+ font-family: "Open Sans", Helvetica, Arial, sans-serif;
42
+ font-size: 14px;
43
+ line-height: 20px;
44
+ letter-spacing: normal;
45
+ @media (max-width: 574px) {
46
+ width: 100px;
47
+ margin: 5px;
48
+ }
49
+ &:hover {
50
+ text-decoration: none;
51
+ background-color: #f0f9fe;
52
+ a {
53
+ color: #2f729c;
54
+ -webkit-font-smoothing: none;
55
+ -moz-osx-font-smoothing: none;
56
+ text-rendering: auto;
57
+ }
58
+ }
59
+ a {
60
+ color: white;
61
+ font-size: 90%;
62
+ line-height: 20px;
63
+ letter-spacing: normal;
64
+ -webkit-font-smoothing: none;
65
+ -moz-osx-font-smoothing: none;
66
+ text-rendering: auto;
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { Container, Typography, Button } from "@mui/material";
3
+ import Link from "../Link";
4
+
5
+ import styles from "./index.module.scss";
6
+
7
+ function SiteBannerTemplate({ data }) {
8
+ const { text, cta_title, cta_link, display } = data || {};
9
+ if (!display) return null;
10
+
11
+ return (
12
+ <div className={styles.siteBannerWrapper}>
13
+ <Container maxWidth="xl" className={styles.siteBannerContainer}>
14
+ <Typography
15
+ dangerouslySetInnerHTML={{ __html: text }}
16
+ className={styles.bannerText}
17
+ />
18
+ <Button className={styles.bannerButton}>
19
+ <Link to={cta_link}>{cta_title}</Link>
20
+ </Button>
21
+ </Container>
22
+ </div>
23
+ );
24
+ }
25
+
26
+ export default SiteBannerTemplate;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import loadable from "@loadable/component";
4
+ import Footer from "./Footer";
5
+ import SponsoredProjectsNav from "./SponsoredProjectsNav";
6
+ import SubscribeForm from "./SubscribeForm";
7
+ import NavBarPlaceholder from "./Navbar/placeholder";
8
+ import SiteBanner from "./SiteBanner";
9
+
10
+ const Navbar = loadable(() => import("./Navbar"), {
11
+ ssr: false,
12
+ fallback: <NavBarPlaceholder />
13
+ });
14
+
15
+ function SiteBannerLayout({ children }) {
16
+ return (
17
+ <div>
18
+ <SponsoredProjectsNav />
19
+ <SiteBanner />
20
+ <Navbar />
21
+ <div>
22
+ <main id="content-wrapper">
23
+ {children}
24
+ <SubscribeForm />
25
+ </main>
26
+ <Footer />
27
+ </div>
28
+ </div>
29
+ );
30
+ }
31
+
32
+ SiteBannerLayout.propTypes = {
33
+ children: PropTypes.node.isRequired
34
+ };
35
+
36
+ export default SiteBannerLayout;
@@ -0,0 +1,6 @@
1
+ {
2
+ "text": "Join the OpenInfra Summit Europe in Paris, Oct 17-19! Registration, CFP & Sponsorships are Open!",
3
+ "cta_title": "Join Us!",
4
+ "cta_link": "https://summit2025.openinfra.org/",
5
+ "display": true
6
+ }
@@ -10,6 +10,8 @@ const COLORS_SASS_FILE_PATH = `${STYLES_DIR_PATH}/colors.scss`;
10
10
  const FONTS_SCSS_FILE_PATH = `${STYLES_DIR_PATH}/fonts.scss`;
11
11
  const SITE_SETTINGS_DIR_PATH = `${STATIC_CONTENT_DIR_PATH}/site-settings`;
12
12
  const SITE_SETTINGS_FILE_PATH = `${SITE_SETTINGS_DIR_PATH}/index.json`;
13
+ const SITE_BANNER_DIR_PATH = `${STATIC_CONTENT_DIR_PATH}/site-banner`;
14
+ const SITE_BANNER_FILE_PATH = `${SITE_BANNER_DIR_PATH}/index.json`;
13
15
  const MARKETING_PAGE_DIR_PATH = `${STATIC_CONTENT_DIR_PATH}/marketing-page`;
14
16
  const MARKETING_PAGE_FILE_PATH = `${MARKETING_PAGE_DIR_PATH}/index.json`;
15
17
  const LOBBY_PAGE_DIR_PATH = `${STATIC_CONTENT_DIR_PATH}/lobby-page`;
@@ -43,7 +45,8 @@ const SPONSORS_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/${SPONSORS_FILE_NAME}`;
43
45
  const CMS_FONT_FILE_PATH = "/static/fonts/";
44
46
  const PAYMENTS_FILE_PATH = `${STATIC_CONTENT_DIR_PATH}/payments.json`;
45
47
  const APPLE_PAY_DOMAIN_FILE_PATH = "/static/.well-known/";
46
- const APPLE_PAY_DOMAIN_FILE_NAME = "apple-developer-merchantid-domain-association";
48
+ const APPLE_PAY_DOMAIN_FILE_NAME =
49
+ "apple-developer-merchantid-domain-association";
47
50
 
48
51
  exports.REQUIRED_DIR_PATHS = [
49
52
  DATA_DIR_PATH,
@@ -52,7 +55,7 @@ exports.REQUIRED_DIR_PATHS = [
52
55
  STYLES_DIR_PATH,
53
56
  SITE_SETTINGS_DIR_PATH,
54
57
  NAVBAR_DIR_PATH,
55
- FOOTER_DIR_PATH,
58
+ FOOTER_DIR_PATH
56
59
  ];
57
60
 
58
61
  exports.DATA_DIR_PATH = DATA_DIR_PATH;
@@ -63,6 +66,7 @@ exports.COLORS_SASS_FILE_PATH = COLORS_SASS_FILE_PATH;
63
66
  exports.FONTS_SCSS_FILE_PATH = FONTS_SCSS_FILE_PATH;
64
67
  exports.SITE_SETTINGS_DIR_PATH = SITE_SETTINGS_DIR_PATH;
65
68
  exports.SITE_SETTINGS_FILE_PATH = SITE_SETTINGS_FILE_PATH;
69
+ exports.SITE_BANNER_FILE_PATH = SITE_BANNER_FILE_PATH;
66
70
  exports.CONTENT_PAGES_DIR_PATH = CONTENT_PAGES_DIR_PATH;
67
71
  exports.MARKETING_PAGE_FILE_PATH = MARKETING_PAGE_FILE_PATH;
68
72
  exports.LOBBY_PAGE_FILE_PATH = LOBBY_PAGE_FILE_PATH;