From cbdfd25e834fe5295c9b92985248d0260b9360b8 Mon Sep 17 00:00:00 2001
From: Jordan Willis <31868510+will0684@users.noreply.github.com>
Date: Thu, 14 Dec 2023 15:08:16 -0500
Subject: [PATCH] Add new component to support new OAS article (#948)
* on project pages, add separate query for articles
* create new ImageVerticalLineContent component for new oas article page
* create function to support multiple layouts for a single AEM fragment
* change new component name
* add support for spans in text-node-renderer
---
.../fragment_components/BasicTextWithImage.js | 36 +++++++++++++
.../ImageVerticalLineContent.js | 32 ++++++++++++
.../fragment_components/TextWithImage.js | 51 +++++++------------
components/text_node_renderer/TextRecur.jsx | 2 +
components/text_node_renderer/nodes/Span.jsx | 3 ++
pages/projects/benefits-navigator/index.js | 6 ++-
.../projects/oas-benefits-estimator/index.js | 6 ++-
7 files changed, 102 insertions(+), 34 deletions(-)
create mode 100644 components/fragment_renderer/fragment_components/BasicTextWithImage.js
create mode 100644 components/fragment_renderer/fragment_components/ImageVerticalLineContent.js
create mode 100644 components/text_node_renderer/nodes/Span.jsx
diff --git a/components/fragment_renderer/fragment_components/BasicTextWithImage.js b/components/fragment_renderer/fragment_components/BasicTextWithImage.js
new file mode 100644
index 0000000000..8c8ad2b5c6
--- /dev/null
+++ b/components/fragment_renderer/fragment_components/BasicTextWithImage.js
@@ -0,0 +1,36 @@
+import TextRender from "../../text_node_renderer/TextRender";
+
+export default function BasicTextWithImage(props) {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/components/fragment_renderer/fragment_components/ImageVerticalLineContent.js b/components/fragment_renderer/fragment_components/ImageVerticalLineContent.js
new file mode 100644
index 0000000000..671980d00f
--- /dev/null
+++ b/components/fragment_renderer/fragment_components/ImageVerticalLineContent.js
@@ -0,0 +1,32 @@
+import TextRender from "../../text_node_renderer/TextRender";
+
+export default function ImageVerticalLineContent(props) {
+ return (
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/components/fragment_renderer/fragment_components/TextWithImage.js b/components/fragment_renderer/fragment_components/TextWithImage.js
index 8e714ba18f..a05276fc83 100644
--- a/components/fragment_renderer/fragment_components/TextWithImage.js
+++ b/components/fragment_renderer/fragment_components/TextWithImage.js
@@ -1,36 +1,23 @@
-import TextRender from "../../text_node_renderer/TextRender";
+import BasicTextWithImage from "./BasicTextWithImage";
+import ImageVerticalLineContent from "./ImageVerticalLineContent";
export default function TextWithImage(props) {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- );
+ );
+ case "image-vertical-line-content":
+ return (
+
+ );
+ default:
+ break;
+ }
}
diff --git a/components/text_node_renderer/TextRecur.jsx b/components/text_node_renderer/TextRecur.jsx
index ac3aa25e39..65b679ddbb 100644
--- a/components/text_node_renderer/TextRecur.jsx
+++ b/components/text_node_renderer/TextRecur.jsx
@@ -6,6 +6,7 @@ import ListItem from "./nodes/ListItem";
import OrderedList from "./nodes/OrderedList";
import Paragraph from "./nodes/Paragraph";
import Text from "./nodes/Text";
+import Span from "./nodes/Span";
import UnorderedList from "./nodes/UnorderedList";
import Link from "./nodes/Link";
@@ -15,6 +16,7 @@ const NODES = {
paragraph: Paragraph,
link: Link,
text: Text,
+ span: Span,
"unordered-list": UnorderedList,
"ordered-list": OrderedList,
"list-item": ListItem,
diff --git a/components/text_node_renderer/nodes/Span.jsx b/components/text_node_renderer/nodes/Span.jsx
new file mode 100644
index 0000000000..0ab57de168
--- /dev/null
+++ b/components/text_node_renderer/nodes/Span.jsx
@@ -0,0 +1,3 @@
+export default function Span(props) {
+ return {props.children};
+}
diff --git a/pages/projects/benefits-navigator/index.js b/pages/projects/benefits-navigator/index.js
index aa0c31d9ed..5fed4ea491 100644
--- a/pages/projects/benefits-navigator/index.js
+++ b/pages/projects/benefits-navigator/index.js
@@ -758,6 +758,10 @@ export const getStaticProps = async ({ locale }) => {
const { data: pageData } = await aemServiceInstance.getFragment(
"benefitsNavigatorQuery"
);
+ // Get updates/article data
+ const { data: updatesData } = await aemServiceInstance.getFragment(
+ "benefitsNavigatorArticlesQuery"
+ );
// get dictionary
const { data: dictionary } = await aemServiceInstance.getFragment(
"dictionaryQuery"
@@ -768,7 +772,7 @@ export const getStaticProps = async ({ locale }) => {
locale: locale,
adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL,
pageData: pageData.sclabsPageV1ByPath,
- updatesData: pageData.sclabsPageV1ByPath.item?.scLabProjectUpdates,
+ updatesData: updatesData.sclabsPageV1List.items,
dictionary: dictionary.dictionaryV1List,
...(await serverSideTranslations(locale, ["common"])),
},
diff --git a/pages/projects/oas-benefits-estimator/index.js b/pages/projects/oas-benefits-estimator/index.js
index 4269273f88..a5ff6a7367 100644
--- a/pages/projects/oas-benefits-estimator/index.js
+++ b/pages/projects/oas-benefits-estimator/index.js
@@ -429,6 +429,10 @@ export const getStaticProps = async ({ locale }) => {
const { data: pageData } = await aemServiceInstance.getFragment(
"oasBenefitsEstimatorQuery"
);
+ // Get updates/article data
+ const { data: updatesData } = await aemServiceInstance.getFragment(
+ "oasBenefitsEstimatorArticlesQuery"
+ );
// get dictionary
const { data: dictionary } = await aemServiceInstance.getFragment(
"dictionaryQuery"
@@ -439,7 +443,7 @@ export const getStaticProps = async ({ locale }) => {
locale: locale,
adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL,
pageData: pageData.sclabsPageV1ByPath,
- updatesData: pageData.sclabsPageV1ByPath.item.scLabProjectUpdates,
+ updatesData: updatesData.sclabsPageV1List.items,
dictionary: dictionary.dictionaryV1List,
...(await serverSideTranslations(locale, ["common"])),
},