From 3548098121656946cf585512f9755863094dd2b9 Mon Sep 17 00:00:00 2001 From: Jordan Willis <31868510+will0684@users.noreply.github.com> Date: Tue, 1 Oct 2024 04:16:49 -0700 Subject: [PATCH] Use getDictionaryTerm to select from dictionary (#1097) * create dictionary term util * fix dictionary terms on project and update pages * remove h3 top-margin when first index * add default margin to h3 * remove top margin from SurevyCTA h3 * add missing import * temporarily remove test returning false positive --- components/molecules/SurveyCTA.js | 2 +- components/text_node_renderer/nodes/Header.jsx | 14 +++++++++++--- cypress/e2e/benefits-finder.cy.js | 2 +- cypress/e2e/benefits-navigator.cy.js | 8 ++++---- cypress/e2e/msca-dashboard.cy.js | 6 +++--- lib/utils/getDictionaryTerm.js | 4 ++++ pages/projects/benefits-finder/[id].js | 9 +++------ pages/projects/benefits-finder/index.js | 11 ++++++----- pages/projects/benefits-navigator/[id].js | 9 +++------ pages/projects/benefits-navigator/index.js | 11 ++++++----- pages/projects/dashboard/[id].js | 9 +++------ pages/projects/dashboard/index.js | 11 ++++++----- pages/projects/digital-standards-playbook/[id].js | 9 +++------ pages/projects/digital-standards-playbook/index.js | 12 +++++++----- pages/projects/making-easier-get-benefits/[id].js | 9 +++------ pages/projects/making-easier-get-benefits/index.js | 11 ++++++----- pages/projects/oas-benefits-estimator/[id].js | 9 +++------ pages/projects/oas-benefits-estimator/index.js | 11 ++++++----- .../transforming-ei-indigenous-peoples/[id].js | 8 ++------ .../transforming-ei-indigenous-peoples/index.js | 11 ++++++----- styles/globals.css | 4 ++-- 21 files changed, 89 insertions(+), 91 deletions(-) create mode 100644 lib/utils/getDictionaryTerm.js diff --git a/components/molecules/SurveyCTA.js b/components/molecules/SurveyCTA.js index 103d8f1109..12512265f2 100644 --- a/components/molecules/SurveyCTA.js +++ b/components/molecules/SurveyCTA.js @@ -10,7 +10,7 @@ export const SurveyCTA = ({ return (
{description}
{pageData.scDateModifiedOverwrite} @@ -60,9 +59,7 @@ export default function BenefitFinderArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/benefits-finder/index.js b/pages/projects/benefits-finder/index.js index 5ed4a80616..3e4ea2602d 100644 --- a/pages/projects/benefits-finder/index.js +++ b/pages/projects/benefits-finder/index.js @@ -11,6 +11,7 @@ import Image from "next/image"; import stageDictionary from "../../../lib/utils/stageDictionary"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function BenefitsFinderOverview(props) { const [pageData] = useState(props.pageData.item); @@ -43,11 +44,11 @@ export default function BenefitsFinderOverview(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/pages/projects/benefits-navigator/[id].js b/pages/projects/benefits-navigator/[id].js index 3d96de4c52..c298790be8 100644 --- a/pages/projects/benefits-navigator/[id].js +++ b/pages/projects/benefits-navigator/[id].js @@ -7,6 +7,7 @@ import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { Heading } from "../../../components/molecules/Heading"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function BenefitNavigatorArticles(props) { const [pageData] = useState(props.pageData); @@ -48,9 +49,7 @@ export default function BenefitNavigatorArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -60,9 +59,7 @@ export default function BenefitNavigatorArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/benefits-navigator/index.js b/pages/projects/benefits-navigator/index.js index 9c07347e64..92c42d052d 100644 --- a/pages/projects/benefits-navigator/index.js +++ b/pages/projects/benefits-navigator/index.js @@ -13,6 +13,7 @@ import stageDictionary from "../../../lib/utils/stageDictionary"; import TextRender from "../../../components/text_node_renderer/TextRender"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; import { ContextualAlert } from "../../../components/molecules/ContextualAlert"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function BenefitsNavigatorOverview(props) { const [pageData] = useState(props.pageData.item); @@ -45,11 +46,11 @@ export default function BenefitsNavigatorOverview(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/pages/projects/dashboard/[id].js b/pages/projects/dashboard/[id].js index 46036c7d38..b3e3cab16b 100644 --- a/pages/projects/dashboard/[id].js +++ b/pages/projects/dashboard/[id].js @@ -7,6 +7,7 @@ import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { Heading } from "../../../components/molecules/Heading"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function MscaDashboardArticles(props) { const [pageData] = useState(props.pageData); @@ -48,9 +49,7 @@ export default function MscaDashboardArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -60,9 +59,7 @@ export default function MscaDashboardArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/dashboard/index.js b/pages/projects/dashboard/index.js index 257391a0b9..0d918f5007 100644 --- a/pages/projects/dashboard/index.js +++ b/pages/projects/dashboard/index.js @@ -14,6 +14,7 @@ import TextRender from "../../../components/text_node_renderer/TextRender"; import Card from "../../../components/molecules/Card"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function MscaDashboard(props) { const pageData = props.pageData?.item; @@ -45,11 +46,11 @@ export default function MscaDashboard(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/pages/projects/digital-standards-playbook/[id].js b/pages/projects/digital-standards-playbook/[id].js index 83f805267e..b697050e9a 100644 --- a/pages/projects/digital-standards-playbook/[id].js +++ b/pages/projects/digital-standards-playbook/[id].js @@ -8,6 +8,7 @@ import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { Heading } from "../../../components/molecules/Heading"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function DigitalStandardsArticles(props) { const { t } = useTranslation("common"); @@ -50,9 +51,7 @@ export default function DigitalStandardsArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -62,9 +61,7 @@ export default function DigitalStandardsArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/digital-standards-playbook/index.js b/pages/projects/digital-standards-playbook/index.js index bfbc9e2e04..80537fee59 100644 --- a/pages/projects/digital-standards-playbook/index.js +++ b/pages/projects/digital-standards-playbook/index.js @@ -11,6 +11,7 @@ import { ActionButton } from "../../../components/atoms/ActionButton"; import Image from "next/image"; import stageDictionary from "../../../lib/utils/stageDictionary"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function DigitalStandardsPlaybookPage(props) { const [pageData] = useState(props.pageData.item); @@ -42,11 +43,11 @@ export default function DigitalStandardsPlaybookPage(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); @@ -56,6 +57,7 @@ export default function DigitalStandardsPlaybookPage(props) { window.adobeDataLayer = window.adobeDataLayer || []; window.adobeDataLayer.push({ event: "pageLoad" }); } + console.log(props.dictionary); }, []); return ( diff --git a/pages/projects/making-easier-get-benefits/[id].js b/pages/projects/making-easier-get-benefits/[id].js index c1e0adcfd2..f0f479d97b 100644 --- a/pages/projects/making-easier-get-benefits/[id].js +++ b/pages/projects/making-easier-get-benefits/[id].js @@ -8,6 +8,7 @@ import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { Heading } from "../../../components/molecules/Heading"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function IntegratedChannelStrategyArticles(props) { const { t } = useTranslation("common"); @@ -50,9 +51,7 @@ export default function IntegratedChannelStrategyArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -62,9 +61,7 @@ export default function IntegratedChannelStrategyArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/making-easier-get-benefits/index.js b/pages/projects/making-easier-get-benefits/index.js index f59754b079..f24ba88a03 100644 --- a/pages/projects/making-easier-get-benefits/index.js +++ b/pages/projects/making-easier-get-benefits/index.js @@ -12,6 +12,7 @@ import TextRender from "../../../components/text_node_renderer/TextRender"; import Image from "next/image"; import stageDictionary from "../../../lib/utils/stageDictionary"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function IntegratedChannelStrategyPage(props) { const [pageData] = useState(props.pageData.item); @@ -44,11 +45,11 @@ export default function IntegratedChannelStrategyPage(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/pages/projects/oas-benefits-estimator/[id].js b/pages/projects/oas-benefits-estimator/[id].js index 1658072063..e7c96ba627 100644 --- a/pages/projects/oas-benefits-estimator/[id].js +++ b/pages/projects/oas-benefits-estimator/[id].js @@ -8,6 +8,7 @@ import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import { Heading } from "../../../components/molecules/Heading"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function OASBenefitsEstimatorArticles(props) { const { t } = useTranslation("common"); @@ -50,9 +51,7 @@ export default function OASBenefitsEstimatorArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -62,9 +61,7 @@ export default function OASBenefitsEstimatorArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/oas-benefits-estimator/index.js b/pages/projects/oas-benefits-estimator/index.js index 8dc2333469..7c6d8b2f93 100644 --- a/pages/projects/oas-benefits-estimator/index.js +++ b/pages/projects/oas-benefits-estimator/index.js @@ -11,6 +11,7 @@ import { Heading } from "../../../components/molecules/Heading"; import Image from "next/image"; import stageDictionary from "../../../lib/utils/stageDictionary"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function OasBenefitsEstimator(props) { const [pageData] = useState(props.pageData.item); @@ -43,11 +44,11 @@ export default function OasBenefitsEstimator(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/pages/projects/transforming-ei-indigenous-peoples/[id].js b/pages/projects/transforming-ei-indigenous-peoples/[id].js index 6c21ebe694..5943c1932e 100644 --- a/pages/projects/transforming-ei-indigenous-peoples/[id].js +++ b/pages/projects/transforming-ei-indigenous-peoples/[id].js @@ -48,9 +48,7 @@ export default function IndigenousEiArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[13].scTermEn - : dictionary[13].scTermFr} + {getDictionaryTerm(dictionary, "POSTED-ON", props.locale)}
{pageData.scDateModifiedOverwrite} @@ -60,9 +58,7 @@ export default function IndigenousEiArticles(props) { props.locale === "en" ? "lg:col-span-2" : "lg:col-span-3" } font-bold`} > - {props.locale === "en" - ? dictionary[8].scTermEn - : dictionary[8].scTermFr} + {getDictionaryTerm(dictionary, "LAST-UPDATED", props.locale)}
{pageData.scDateModifiedOverwrite} diff --git a/pages/projects/transforming-ei-indigenous-peoples/index.js b/pages/projects/transforming-ei-indigenous-peoples/index.js index 7bab629cb9..b8893720f4 100644 --- a/pages/projects/transforming-ei-indigenous-peoples/index.js +++ b/pages/projects/transforming-ei-indigenous-peoples/index.js @@ -12,6 +12,7 @@ import stageDictionary from "../../../lib/utils/stageDictionary"; import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; import TextRender from "../../../components/text_node_renderer/TextRender"; +import { getDictionaryTerm } from "../../../lib/utils/getDictionaryTerm"; export default function EiIndigenousOverview(props) { const [pageData] = useState(props.pageData.item); @@ -44,11 +45,11 @@ export default function EiIndigenousOverview(props) { imgWidth={update.scSocialMediaImageEn.width} title={props.locale === "en" ? update.scTitleEn : update.scTitleFr} href={props.locale === "en" ? update.scPageNameEn : update.scPageNameFr} - description={`${ - props.locale === "en" - ? props.dictionary.items[13].scTermEn - : props.dictionary.items[13].scTermFr - } ${update.scDateModifiedOverwrite}`} + description={`${getDictionaryTerm( + props.dictionary.items, + "POSTED-ON", + props.locale + )} ${update.scDateModifiedOverwrite}`} /> )); diff --git a/styles/globals.css b/styles/globals.css index 946d40d392..3fcb996e0b 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -66,11 +66,11 @@ html { /* Content Element Styles */ h1, - h2 { + h2, + h3 { margin-top: 48px; margin-bottom: 24px; } - h3, h4, h5 { margin-bottom: 16px;