diff --git a/src/build-utils/helpers/contentfulContentModel.js b/src/build-utils/helpers/contentfulContentModel.js index 482b69e6..2df65972 100644 --- a/src/build-utils/helpers/contentfulContentModel.js +++ b/src/build-utils/helpers/contentfulContentModel.js @@ -25,6 +25,8 @@ const link = ` const linkCollectionModule = ` heading + subheading + variant image { gatsbyImageData( formats: WEBP @@ -124,7 +126,7 @@ const resourceItem = ` const resourceListModule = ` heading - subheading { + subheadingRich: subheading { raw } resources { @@ -277,6 +279,20 @@ const promotionBannerModule = ` } `; +const stepsModule = ` + steps { + ... on Node { + id + internal { + type + } + ... on ContentfulFaqItem { + ${faqItem} + } + } + } +`; + module.exports = { hero, seo, @@ -296,4 +312,5 @@ module.exports = { pageData, promoLine, promotionBannerModule, + stepsModule, }; diff --git a/src/build-utils/pages/homePage.js b/src/build-utils/pages/homePage.js index 6a1f0d92..1c2598ed 100644 --- a/src/build-utils/pages/homePage.js +++ b/src/build-utils/pages/homePage.js @@ -8,7 +8,10 @@ const { } = require(`../helpers/hooks`); const { logContentfulWarning } = require(`../helpers/utils`); -const homepageId = `VoE6QU1LhN2Y5h6Tja3fq`; +// comment out one line to determine which homepage you want to render +// don't forget to uncomment correct homepage before merging PR +// const homepageId = `VoE6QU1LhN2Y5h6Tja3fq`; // this is the PRODUCTION homepage +const homepageId = `2hHrtVu5fUseOPMTxz82fV`; // this is the DUMMY homepage const query = (graphql) => { return graphql(` diff --git a/src/build-utils/pages/modularPage.js b/src/build-utils/pages/modularPage.js index 7befa9c6..c6c31b9b 100644 --- a/src/build-utils/pages/modularPage.js +++ b/src/build-utils/pages/modularPage.js @@ -48,6 +48,12 @@ const query = (graphql) => { ... on ContentfulHelpSearchModule { ${contentModel.helpSearchModule} } + ... on ContentfulStepsModule { + ${contentModel.stepsModule} + } + ... on ContentfulFaqCategoriesModule { + ${contentModel.faqCategoriesModule} + } } } includeContactForm diff --git a/src/components/Button/Button.css b/src/components/Button/Button.css index aea5302c..e9b3582e 100644 --- a/src/components/Button/Button.css +++ b/src/components/Button/Button.css @@ -90,6 +90,16 @@ } } + &--tertiary { + background: #eaf1ff; + + &:hover { + &::after { + display: none; + } + } + } + .Icon { --icon-size: 20px; diff --git a/src/components/ContentfulModule/ContentfulModule.jsx b/src/components/ContentfulModule/ContentfulModule.jsx index 74f9af9c..94829140 100644 --- a/src/components/ContentfulModule/ContentfulModule.jsx +++ b/src/components/ContentfulModule/ContentfulModule.jsx @@ -12,6 +12,7 @@ import { HelpSearch } from "../HelpSearch"; import { PartnersModule } from "./PartnersModule"; import { FaqCategoriesModule } from "./FaqCategoriesModule"; import { PromotionBannerModule } from "./PromotionBannerModule"; +import { StepsModule } from "./StepsModule"; const ContentfulModule = ({ module, pathname }) => { const type = module?.internal?.type || ``; @@ -60,6 +61,10 @@ const ContentfulModule = ({ module, pathname }) => { return ; } + if (type === `ContentfulStepsModule`) { + return ; + } + return null; }; diff --git a/src/components/ContentfulModule/ContentfulModulePropTypes.js b/src/components/ContentfulModule/ContentfulModulePropTypes.js index d556c091..ad34fd3a 100644 --- a/src/components/ContentfulModule/ContentfulModulePropTypes.js +++ b/src/components/ContentfulModule/ContentfulModulePropTypes.js @@ -12,6 +12,7 @@ import { HelpSearchPropTypes } from "../HelpSearch"; import { PartnersModulePropTypes } from "./PartnersModule"; import { FaqCategoriesModulePropTypes } from "./FaqCategoriesModule"; import { PromotionBannerModulePropTypes } from "./PromotionBannerModule"; +import { StepsModulePropTypes } from "./StepsModule"; const ContentfulModulePropTypes = PropTypes.oneOfType([ PropTypes.shape(EventsModulePropTypes), @@ -24,6 +25,7 @@ const ContentfulModulePropTypes = PropTypes.oneOfType([ PropTypes.shape(PartnersModulePropTypes), PropTypes.shape(FaqCategoriesModulePropTypes), PropTypes.shape(PromotionBannerModulePropTypes), + PropTypes.shape(StepsModulePropTypes), ]); export default ContentfulModulePropTypes; diff --git a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.jsx b/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.jsx index 50d9ed45..82a42af0 100644 --- a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.jsx +++ b/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.jsx @@ -1,58 +1,29 @@ import React from "react"; -import { LinkCollectionModulePropTypes } from "./LinkCollectionModulePropTypes"; -import Button from "../../Button"; -import Constraint from "../../Constraint"; -import LinkCollectionWithImage from "../../LinkCollectionWithImage"; -import Section from "../../Section"; - -import "./LinkCollectionModule.css"; - -const LinkCollectionModule = ({ links, heading, image }) => { - if (image) { - return ( -
- - - {links.map(({ id, url, label }) => { - if (!label || !url) { - return null; - } - return ( -
  • - -
  • - ); - })} -
    -
    -
    - ); +import { + LinkCollectionModuleDefaultProps, + LinkCollectionModulePropTypes, +} from "./LinkCollectionModulePropTypes"; +import LcmWithImage from "./variants/LcmWithImage"; +import LcmDefault from "./variants/LcmDefault"; +import LcmLightBlocks from "./variants/LcmLightBlocks"; + +const LinkCollectionModule = (props) => { + const { variant } = props; + + if (variant === `with-image`) { + return ; + } + + if (variant === `light-blocks`) { + return ; } - return ( -
    - {!!heading &&

    {heading}

    } -
      - {links.map((link) => { - return ( -
    • - -
    • - ); - })} -
    -
    - ); + + return ; }; LinkCollectionModule.propTypes = LinkCollectionModulePropTypes; -LinkCollectionModule.defaultProps = { - title: ``, -}; +LinkCollectionModule.defaultProps = LinkCollectionModuleDefaultProps; export default LinkCollectionModule; diff --git a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModulePropTypes.js b/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModulePropTypes.js index 5dd5a080..7da37cd4 100644 --- a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModulePropTypes.js +++ b/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModulePropTypes.js @@ -1,7 +1,9 @@ import PropTypes from "prop-types"; const LinkCollectionModulePropTypes = { - title: PropTypes.string, + heading: PropTypes.string, + subheading: PropTypes.string, + variant: PropTypes.oneOf([`default`, `light-blocks`, `with-image`]), links: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.string.isRequired, @@ -11,4 +13,10 @@ const LinkCollectionModulePropTypes = { ).isRequired, }; -export { LinkCollectionModulePropTypes }; +const LinkCollectionModuleDefaultProps = { + heading: ``, + subheading: ``, + variant: `default`, +}; + +export { LinkCollectionModulePropTypes, LinkCollectionModuleDefaultProps }; diff --git a/src/components/ContentfulModule/LinkCollectionModule/index.js b/src/components/ContentfulModule/LinkCollectionModule/index.js index 675c65f8..b60271ee 100644 --- a/src/components/ContentfulModule/LinkCollectionModule/index.js +++ b/src/components/ContentfulModule/LinkCollectionModule/index.js @@ -1,4 +1,11 @@ import LinkCollectionModule from "./LinkCollectionModule"; -import { LinkCollectionModulePropTypes } from "./LinkCollectionModulePropTypes"; +import { + LinkCollectionModulePropTypes, + LinkCollectionModuleDefaultProps, +} from "./LinkCollectionModulePropTypes"; -export { LinkCollectionModule, LinkCollectionModulePropTypes }; +export { + LinkCollectionModule, + LinkCollectionModulePropTypes, + LinkCollectionModuleDefaultProps, +}; diff --git a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.css b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.css similarity index 98% rename from src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.css rename to src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.css index d0eb5bdb..b8a31fae 100644 --- a/src/components/ContentfulModule/LinkCollectionModule/LinkCollectionModule.css +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.css @@ -1,4 +1,4 @@ -.LinkCollectionModule { +.LcmDefault { margin: var(--s__main-padding) 0; overflow: hidden; width: 100%; diff --git a/src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.jsx b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.jsx new file mode 100644 index 00000000..7eca8e47 --- /dev/null +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmDefault.jsx @@ -0,0 +1,34 @@ +import React from "react"; + +import Button from "../../../Button"; +import { + LinkCollectionModuleDefaultProps, + LinkCollectionModulePropTypes, +} from "../LinkCollectionModulePropTypes"; + +import "./LcmDefault.css"; + +const LcmDefault = ({ heading, links }) => { + return ( +
    + {!!heading &&

    {heading}

    } +
      + {links.map((link) => { + return ( +
    • + +
    • + ); + })} +
    +
    + ); +}; + +LcmDefault.propTypes = LinkCollectionModulePropTypes; + +LcmDefault.defaultProps = LinkCollectionModuleDefaultProps; + +export default LcmDefault; diff --git a/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.css b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.css new file mode 100644 index 00000000..a7759a34 --- /dev/null +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.css @@ -0,0 +1,62 @@ +.LcmLightBlocks { + margin: var(--s__main-padding) 0; + overflow: hidden; + width: 100%; + + &__heading { + font-size: 1.8rem; + margin: 0; + } + + &__button-list { + display: flex; + flex-direction: column; + font-size: var(--fs__h5); + gap: calc(var(--s__unit) * 6); + list-style: none; + padding: 0; + + li { + width: 100%; + } + + .Button { + border-radius: var(--s__alt-border-radius); + box-sizing: border-box; + height: 100%; + justify-content: center; + padding: calc(var(--s__unit) * 6); + text-align: center; + text-transform: none; + width: 100%; + + &::after { + display: none; + } + } + } + + @media (min-width: 60rem) { + &__heading { + font-size: var(--fs__h3); + } + + &__button-list { + flex-direction: row; + font-size: 1.5rem; + justify-content: space-between; + + > * { + flex: 1; + } + } + + .Button { + box-shadow: none; + + .Icon { + display: none; + } + } + } +} diff --git a/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.jsx b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.jsx new file mode 100644 index 00000000..f9155ac3 --- /dev/null +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmLightBlocks.jsx @@ -0,0 +1,42 @@ +import React from "react"; + +import Button from "../../../Button"; +import Constraint from "../../../Constraint"; +import Section from "../../../Section"; +import { + LinkCollectionModuleDefaultProps, + LinkCollectionModulePropTypes, +} from "../LinkCollectionModulePropTypes"; + +import "./LcmLightBlocks.css"; + +const LcmLightBlocks = ({ heading, subheading, links }) => { + console.log({ links }); + return ( +
    + + {!!heading &&

    {heading}

    } + {!!subheading && ( +

    {subheading}

    + )} +
      + {links.map((link) => { + return ( +
    • + +
    • + ); + })} +
    +
    +
    + ); +}; + +LcmLightBlocks.propTypes = LinkCollectionModulePropTypes; + +LcmLightBlocks.defaultProps = LinkCollectionModuleDefaultProps; + +export default LcmLightBlocks; diff --git a/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.css b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.css new file mode 100644 index 00000000..1fea6d81 --- /dev/null +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.css @@ -0,0 +1,116 @@ +.LcmWithImage { + background-color: #f6f6f6; + + &__text { + margin-bottom: calc(var(--s__unit) * 10); + padding-top: calc(var(--s__unit) * 10); + } + + &__title { + font-size: var(--fs__h4); + margin: 0; + margin-bottom: calc(var(--s__unit) * 10); + } + + &__button-list { + display: flex; + flex-direction: column; + font-size: 1.25rem; + list-style: none; + padding: 0; + + li { + padding: var(--s__main-padding) 0; + + &:first-of-type { + padding-top: 0; + } + + + li { + border-top: 1px solid #ececec; + } + } + } + + &__image { + .gatsby-image-wrapper { + height: 100%; + + /* Fuck this hack, but ok. */ + margin: 0 -16px; + width: 100%; + width: calc(100% + 32px); + } + } + + .Button { + border: none; + color: var(--c__main-color); + justify-content: space-between; + padding: 0; + text-transform: none; + + .Icon { + --icon-size: 32px; + + margin-left: var(--s__main-padding); + min-width: var(--icon-size); + } + + &:hover { + text-decoration: underline; + + &::after { + transform: none; + } + } + } + + @media (min-width: 40rem) { + &__section { + display: flex; + + > * { + flex: 1; + } + } + + &__text { + margin-bottom: 0; + padding-right: var(--s__main-padding); + padding-top: calc(var(--s__alt-padding) * 2); + } + + &__title { + font-size: var(--fs__h3); + margin-bottom: calc(var(--s__alt-padding) * 2); + } + + &__button-list { + font-size: 1.5rem; + + li { + padding: var(--s__alt-padding) 0; + + &:first-of-type { + padding-top: 0; + } + + + li { + border: none; + } + } + } + + &__image { + .gatsby-image-wrapper { + margin: unset; + width: 100%; + } + } + + .Button { + display: inline-flex; + } + } +} diff --git a/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.jsx b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.jsx new file mode 100644 index 00000000..10d73140 --- /dev/null +++ b/src/components/ContentfulModule/LinkCollectionModule/variants/LcmWithImage.jsx @@ -0,0 +1,56 @@ +import React from "react"; + +import Section from "../../../Section"; +import Constraint from "../../../Constraint"; +import Button from "../../../Button"; +import { GatsbyImage, getImage } from "gatsby-plugin-image"; +import { + LinkCollectionModuleDefaultProps, + LinkCollectionModulePropTypes, +} from "../LinkCollectionModulePropTypes"; + +import "./LcmWithImage.css"; + +const LcmWithImage = ({ heading, links, image }) => { + return ( +
    + +
    +
    + {!!heading &&

    {heading}

    } +
      + {links.map(({ id, url, label }) => { + if (!label || !url) { + return null; + } + return ( +
    • + +
    • + ); + })} +
    +
    + + {image && ( +
    + +
    + )} +
    +
    +
    + ); +}; + +LcmWithImage.propTypes = LinkCollectionModulePropTypes; + +LcmWithImage.defaultProps = LinkCollectionModuleDefaultProps; + +export default LcmWithImage; diff --git a/src/components/ContentfulModule/ResourceListModule/ResourceListModule.jsx b/src/components/ContentfulModule/ResourceListModule/ResourceListModule.jsx index 0ea7e14b..9182e94b 100644 --- a/src/components/ContentfulModule/ResourceListModule/ResourceListModule.jsx +++ b/src/components/ContentfulModule/ResourceListModule/ResourceListModule.jsx @@ -8,11 +8,11 @@ import { import { formatRichText } from "../../../helpers/formatting"; import ResourceItem from "./ResourceItem"; -const ResourceListModule = ({ heading, subheading, resources }) => { +const ResourceListModule = ({ heading, subheadingRich, resources }) => { return (
    {!!heading &&

    {heading}

    } - {subheading?.raw && formatRichText(subheading.raw)} + {subheadingRich?.raw && formatRichText(subheadingRich.raw)}
      {resources?.at(0) && resources.map((item) => { diff --git a/src/components/ContentfulModule/ResourceListModule/ResourceListModulePropTypes.js b/src/components/ContentfulModule/ResourceListModule/ResourceListModulePropTypes.js index 1d5eb814..dae0803b 100644 --- a/src/components/ContentfulModule/ResourceListModule/ResourceListModulePropTypes.js +++ b/src/components/ContentfulModule/ResourceListModule/ResourceListModulePropTypes.js @@ -10,7 +10,7 @@ const ResourceItemPropTypes = { const ResourceListModulePropTypes = { id: PropTypes.string.isRequired, heading: PropTypes.string, - subheading: PropTypes.shape({ + subheadingRich: PropTypes.shape({ raw: PropTypes.string, }), resources: PropTypes.arrayOf(PropTypes.shape(ResourceItemPropTypes)), @@ -18,7 +18,7 @@ const ResourceListModulePropTypes = { const ResourceListModuleDefaultProps = { heading: ``, - subheading: { + subheadingRich: { raw: ``, }, }; diff --git a/src/components/ContentfulModule/StepsModule/StepsModule.css b/src/components/ContentfulModule/StepsModule/StepsModule.css new file mode 100644 index 00000000..cdb13ae8 --- /dev/null +++ b/src/components/ContentfulModule/StepsModule/StepsModule.css @@ -0,0 +1,51 @@ +.StepsModule { + display: flex; + flex-direction: column; + gap: calc(var(--s__unit) * 6); + padding: var(--s__main-padding) 0; + + details { + border: 1px solid #ececec; + border-radius: var(--s__main-border-radius); + padding: var(--s__main-padding); + + &[open] summary::after { + transform: rotate(135deg); + } + } + + summary { + align-items: center; + border-bottom: 1px solid #ececec; + color: var(--c__primary); + cursor: pointer; + display: flex; + justify-content: space-between; + + &, + h3 { + font-size: 1.5rem; + } + + h3 { + font-weight: var(--fw__small); + } + + &::after { + border-color: var(--c__primary); + border-style: solid; + border-width: 0.15em 0.15em 0 0; + content: ""; + display: inline-block; + height: 0.45em; + left: -0.5em; + margin-left: 2rem; + position: relative; + transform: rotate(45deg) translateY(50%); + transform-origin: center; + transition: transform 0.2s ease; + vertical-align: middle; + width: 0.45em; + } + } +} diff --git a/src/components/ContentfulModule/StepsModule/StepsModule.jsx b/src/components/ContentfulModule/StepsModule/StepsModule.jsx new file mode 100644 index 00000000..04f566f1 --- /dev/null +++ b/src/components/ContentfulModule/StepsModule/StepsModule.jsx @@ -0,0 +1,61 @@ +import React from "react"; +import { formatRichText } from "../../../helpers/formatting"; +import { + StepsModulePropTypes, + StepsModuleDefaultProps, +} from "./StepsModulePropTypes"; +import { getTranslatedText } from "../../../utils/getTranslatedText"; +import { handleAnchorClick } from "../../Faq"; + +import "./StepsModule.css"; +import { useEffect } from "react"; +import { openDetailsByHash } from "../../../helpers/handlers"; + +const StepsModule = ({ steps }) => { + useEffect(() => { + window.addEventListener(`hashchange`, openDetailsByHash); + openDetailsByHash(); + + return () => { + window.removeEventListener(`hashchange`, openDetailsByHash); + }; + }, []); + + return ( +
      + {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 ( -
      -
      - {!!title &&

      {title}

      } -
        {children}
      -
      - - {image && ( -
      - -
      - )} -
      - ); -}; - -LinkCollectionWithImage.propTypes = { - title: PropTypes.string, - children: PropTypes.node, - image: gatsbyImagePropType, -}; - -export default LinkCollectionWithImage; diff --git a/src/components/LinkCollectionWithImage/index.js b/src/components/LinkCollectionWithImage/index.js deleted file mode 100644 index 5c2b5544..00000000 --- a/src/components/LinkCollectionWithImage/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./LinkCollectionWithImage"; diff --git a/src/components/Section/Section.css b/src/components/Section/Section.css index 39601c13..1ebd95b6 100644 --- a/src/components/Section/Section.css +++ b/src/components/Section/Section.css @@ -28,10 +28,6 @@ &.ProtestFormsSection { margin-bottom: calc(var(--s__unit) * 10); } - - &.BeVigilantSection { - background-color: #f6f6f6; - } } .HeroSection { diff --git a/src/constants/AdditionalNavigation.js b/src/constants/AdditionalNavigation.js index d0abb509..0fe0acc1 100644 --- a/src/constants/AdditionalNavigation.js +++ b/src/constants/AdditionalNavigation.js @@ -35,4 +35,15 @@ export const ADDITIONAL_NAVIGATION = { title: `Donation`, }, ], + // @todo: fix these links once we have all the slugs for personalized guide pages + "/ua/guide-for-new-arrivals": [ + { + pathname: `/ua`, + title: `Temp link`, + }, + { + pathname: `/ua`, + title: `temp link 2`, + }, + ], }; diff --git a/src/helpers/handlers.js b/src/helpers/handlers.js index a1348954..9ba52cbc 100644 --- a/src/helpers/handlers.js +++ b/src/helpers/handlers.js @@ -26,4 +26,31 @@ const getRichTextModuleData = (node, refs) => { return moduleData || null; }; -export { isUkrainianPage, getLocaleFromPath, getRichTextModuleData }; +// Used stackoverflow as reference +// Not a 1:1 copy +// https://stackoverflow.com/a/37033774 +const openDetailsByHash = () => { + const hash = location.hash.substring(1); + if (hash) { + const hashElement = document.getElementById(hash); + if (hashElement.tagName === `DETAILS`) { + hashElement.open = true; + return; + } + + const details = Array.from(hashElement.children).find( + ({ tagName }) => tagName === `DETAILS` + ); + + if (details) { + details.open = true; + } + } +}; + +export { + isUkrainianPage, + getLocaleFromPath, + getRichTextModuleData, + openDetailsByHash, +}; diff --git a/src/templates/modularPage.jsx b/src/templates/modularPage.jsx index e0669116..cb6e6e35 100644 --- a/src/templates/modularPage.jsx +++ b/src/templates/modularPage.jsx @@ -96,6 +96,7 @@ const ModularPage = ({ path, pageContext }) => { ); })}