+ {steps.map((step, index) => {
+ const tabId = `tab-${index + 1}`;
+ return (
+
+
+
+ Step {index + 1}. {step.question}
+
+
+ {formatRichText(step.answer.raw)}
+
+
+ );
+ })}
+
+ );
+};
+
+StepsModule.propTypes = StepsModulePropTypes;
+
+StepsModule.defaultProps = StepsModuleDefaultProps;
+
+export default StepsModule;
diff --git a/src/components/ContentfulModule/StepsModule/StepsModulePropTypes.js b/src/components/ContentfulModule/StepsModule/StepsModulePropTypes.js
new file mode 100644
index 00000000..22d9b6c3
--- /dev/null
+++ b/src/components/ContentfulModule/StepsModule/StepsModulePropTypes.js
@@ -0,0 +1,14 @@
+import PropTypes from "prop-types";
+import { FaqItemPropTypes } from "../../Faq";
+
+const StepsModulePropTypes = {
+ steps: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.shape(FaqItemPropTypes)])
+ ),
+};
+
+const StepsModuleDefaultProps = {
+ steps: [],
+};
+
+export { StepsModuleDefaultProps, StepsModulePropTypes };
diff --git a/src/components/ContentfulModule/StepsModule/index.js b/src/components/ContentfulModule/StepsModule/index.js
new file mode 100644
index 00000000..d22db113
--- /dev/null
+++ b/src/components/ContentfulModule/StepsModule/index.js
@@ -0,0 +1,7 @@
+import StepsModule from "./StepsModule";
+import {
+ StepsModulePropTypes,
+ StepsModuleDefaultProps,
+} from "./StepsModulePropTypes";
+
+export { StepsModule, StepsModuleDefaultProps, StepsModulePropTypes };
diff --git a/src/components/Faq/Faq.js b/src/components/Faq/Faq.js
index 83c85653..97e9f62a 100644
--- a/src/components/Faq/Faq.js
+++ b/src/components/Faq/Faq.js
@@ -14,23 +14,7 @@ import { ResourceListModulePropTypes } from "../ContentfulModule/ResourceListMod
import { formatRichText } from "../../helpers/formatting";
import "./Faq.css";
-
-// Used stackoverflow as reference
-// Not a 1:1 copy
-// https://stackoverflow.com/a/37033774
-const openTarget = () => {
- const hash = location.hash.substring(1);
- if (hash) {
- const details = Array.from(document.getElementById(hash).children).find(
- (element) => {
- return element.tagName === `DETAILS`;
- }
- );
- if (details) {
- details.open = true;
- }
- }
-};
+import { openDetailsByHash } from "../../helpers/handlers";
const Faq = ({
title,
@@ -42,11 +26,11 @@ const Faq = ({
crumbs,
}) => {
useEffect(() => {
- window.addEventListener(`hashchange`, openTarget);
- openTarget();
+ window.addEventListener(`hashchange`, openDetailsByHash);
+ openDetailsByHash();
return () => {
- window.removeEventListener(`hashchange`, openTarget);
+ window.removeEventListener(`hashchange`, openDetailsByHash);
};
}, []);
diff --git a/src/components/Faq/index.js b/src/components/Faq/index.js
index a873fe26..d9b935d1 100644
--- a/src/components/Faq/index.js
+++ b/src/components/Faq/index.js
@@ -3,6 +3,7 @@ import { FaqNavDataPropTypes } from "./Faq";
import { FaqNav } from "./FaqNav";
import { FaqItemPropTypes } from "./FaqModule/FaqItem";
import { FaqModulePropTypes } from "./FaqModule/FaqModulePropTypes";
+import { handleAnchorClick } from "./FaqModule/FaqItem/faqItemUtils";
export {
Faq,
@@ -10,4 +11,5 @@ export {
FaqNav,
FaqItemPropTypes,
FaqModulePropTypes,
+ handleAnchorClick,
};
diff --git a/src/components/LinkCollectionWithImage/LinkCollectionWithImage.js b/src/components/LinkCollectionWithImage/LinkCollectionWithImage.js
deleted file mode 100644
index 3bd32c7f..00000000
--- a/src/components/LinkCollectionWithImage/LinkCollectionWithImage.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import * as React from "react";
-import PropTypes from "prop-types";
-import { GatsbyImage, getImage } from "gatsby-plugin-image";
-
-// Style.
-import "./LinkCollectionWithImage.css";
-import { gatsbyImagePropType } from "../../helpers/genericPropTypes";
-
-const LinkCollectionWithImage = ({ title, children, image }) => {
- return (
-