@treely/strapi-slices 1.0.0
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/components/CreditsAvailableBadge/CreditsAvailableBadge.d.ts +7 -0
- package/dist/components/CreditsAvailableBadge/index.d.ts +2 -0
- package/dist/components/CreditsAvailableBadge/messages.de.d.ts +7 -0
- package/dist/components/CreditsAvailableBadge/messages.en.d.ts +7 -0
- package/dist/components/FullScreenImage/FullScreenImage.d.ts +8 -0
- package/dist/components/FullScreenImage/ZoomableImage.d.ts +7 -0
- package/dist/components/FullScreenImage/index.d.ts +2 -0
- package/dist/components/MinimalProviders/MinimalProviders.d.ts +7 -0
- package/dist/components/MinimalProviders/index.d.ts +2 -0
- package/dist/components/SliceRenderer/SliceRenderer.d.ts +12 -0
- package/dist/components/SliceRenderer/index.d.ts +2 -0
- package/dist/components/StrapiLinkButton/StrapiLinkButton.d.ts +18 -0
- package/dist/components/StrapiLinkButton/index.d.ts +2 -0
- package/dist/components/StrapiLinkButtonWithIcon/StrapiLinkButtonWithIcon.d.ts +7 -0
- package/dist/components/StrapiLinkButtonWithIcon/index.d.ts +2 -0
- package/dist/components/portfolio/Contact/Contact.d.ts +10 -0
- package/dist/components/portfolio/Contact/index.d.ts +2 -0
- package/dist/components/portfolio/DocumentsDownloadList/DocumentsDownloadList.d.ts +6 -0
- package/dist/components/portfolio/DocumentsDownloadList/index.d.ts +2 -0
- package/dist/components/portfolio/DocumentsDownloadList/messages.de.d.ts +5 -0
- package/dist/components/portfolio/DocumentsDownloadList/messages.en.d.ts +5 -0
- package/dist/components/portfolio/ProjectInfo/ProjectInfo.d.ts +18 -0
- package/dist/components/portfolio/ProjectInfo/index.d.ts +2 -0
- package/dist/components/portfolio/ProjectInfo/messages.de.d.ts +15 -0
- package/dist/components/portfolio/ProjectInfo/messages.en.d.ts +15 -0
- package/dist/components/portfolio/SmallCheckout/SmallCheckout.d.ts +13 -0
- package/dist/components/portfolio/SmallCheckout/index.d.ts +2 -0
- package/dist/components/portfolio/SmallCheckout/messages.de.d.ts +16 -0
- package/dist/components/portfolio/SmallCheckout/messages.en.d.ts +16 -0
- package/dist/constants/animations.d.ts +1 -0
- package/dist/constants/api.d.ts +3 -0
- package/dist/constants/breakpoints.d.ts +8 -0
- package/dist/constants/domain.d.ts +2 -0
- package/dist/constants/fontCustomizations.d.ts +6 -0
- package/dist/constants/formatter.d.ts +6 -0
- package/dist/constants/globalStyle.d.ts +1 -0
- package/dist/constants/mapbox.d.ts +17 -0
- package/dist/constants/strapi.d.ts +1 -0
- package/dist/icons/LinkedInIcon.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/models/BBox.d.ts +2 -0
- package/dist/models/CreditsAvailableState.d.ts +7 -0
- package/dist/models/Locale.d.ts +2 -0
- package/dist/models/PortfolioProject.d.ts +7 -0
- package/dist/models/forms/CheckoutForm.d.ts +4 -0
- package/dist/models/fpm/FPMProject.d.ts +37 -0
- package/dist/models/fpm/Issuer.d.ts +6 -0
- package/dist/models/strapi/IStrapi.d.ts +4 -0
- package/dist/models/strapi/IStrapiData.d.ts +5 -0
- package/dist/models/strapi/IStrapiResponse.d.ts +13 -0
- package/dist/models/strapi/StrapiAuthor.d.ts +10 -0
- package/dist/models/strapi/StrapiAvatarWithName.d.ts +8 -0
- package/dist/models/strapi/StrapiBanner.d.ts +9 -0
- package/dist/models/strapi/StrapiBlogPost.d.ts +25 -0
- package/dist/models/strapi/StrapiButtonWithVariant.d.ts +6 -0
- package/dist/models/strapi/StrapiCategory.d.ts +8 -0
- package/dist/models/strapi/StrapiContactArea.d.ts +10 -0
- package/dist/models/strapi/StrapiCustomerStory.d.ts +21 -0
- package/dist/models/strapi/StrapiDefaultHeader.d.ts +6 -0
- package/dist/models/strapi/StrapiGlobal.d.ts +26 -0
- package/dist/models/strapi/StrapiGlossaryItem.d.ts +6 -0
- package/dist/models/strapi/StrapiHeroCard.d.ts +13 -0
- package/dist/models/strapi/StrapiImage.d.ts +10 -0
- package/dist/models/strapi/StrapiImageFormat.d.ts +12 -0
- package/dist/models/strapi/StrapiImageWithLink.d.ts +6 -0
- package/dist/models/strapi/StrapiLink.d.ts +11 -0
- package/dist/models/strapi/StrapiLinkList.d.ts +7 -0
- package/dist/models/strapi/StrapiLinkPage.d.ts +10 -0
- package/dist/models/strapi/StrapiLinkWithIcon.d.ts +7 -0
- package/dist/models/strapi/StrapiLocalization.d.ts +7 -0
- package/dist/models/strapi/StrapiMedia.d.ts +27 -0
- package/dist/models/strapi/StrapiMetadata.d.ts +13 -0
- package/dist/models/strapi/StrapiNavMenu.d.ts +13 -0
- package/dist/models/strapi/StrapiPage.d.ts +17 -0
- package/dist/models/strapi/StrapiPortfolio.d.ts +10 -0
- package/dist/models/strapi/StrapiPortfolioCard.d.ts +15 -0
- package/dist/models/strapi/StrapiProject.d.ts +23 -0
- package/dist/models/strapi/StrapiProjectCard.d.ts +18 -0
- package/dist/models/strapi/StrapiQuoteCard.d.ts +7 -0
- package/dist/models/strapi/StrapiShapesCard.d.ts +11 -0
- package/dist/models/strapi/StrapiTextCardWithIcons.d.ts +8 -0
- package/dist/models/strapi/StrapiTopBanner.d.ts +7 -0
- package/dist/rootMessages.de.d.ts +58 -0
- package/dist/rootMessages.en.d.ts +58 -0
- package/dist/slices/Blog/Blog.d.ts +10 -0
- package/dist/slices/Blog/index.d.ts +2 -0
- package/dist/slices/Blog/styles.d.ts +9 -0
- package/dist/slices/BlogCards/BlogCards.d.ts +18 -0
- package/dist/slices/BlogCards/BlogCards.stories.d.ts +5 -0
- package/dist/slices/BlogCards/index.d.ts +2 -0
- package/dist/slices/Comparison/Comparison.d.ts +33 -0
- package/dist/slices/Comparison/Comparison.stories.d.ts +6 -0
- package/dist/slices/Comparison/Icon.d.ts +7 -0
- package/dist/slices/Comparison/index.d.ts +2 -0
- package/dist/slices/Comparison/messages.de.d.ts +4 -0
- package/dist/slices/Comparison/messages.en.d.ts +4 -0
- package/dist/slices/Cta/Cta.d.ts +26 -0
- package/dist/slices/Cta/Cta.stories.d.ts +9 -0
- package/dist/slices/Cta/index.d.ts +2 -0
- package/dist/slices/Cta/messages.de.d.ts +5 -0
- package/dist/slices/Cta/messages.en.d.ts +5 -0
- package/dist/slices/CtaOnly/CtaOnly.d.ts +8 -0
- package/dist/slices/CtaOnly/CtaOnly.stories.d.ts +3 -0
- package/dist/slices/CtaOnly/index.d.ts +2 -0
- package/dist/slices/CustomerStories/CustomerStories.d.ts +10 -0
- package/dist/slices/CustomerStories/CustomerStories.stories.d.ts +3 -0
- package/dist/slices/CustomerStories/index.d.ts +2 -0
- package/dist/slices/CustomerStories/messages.de.d.ts +4 -0
- package/dist/slices/CustomerStories/messages.en.d.ts +4 -0
- package/dist/slices/Facts/Facts.d.ts +16 -0
- package/dist/slices/Facts/Facts.stories.d.ts +7 -0
- package/dist/slices/Facts/index.d.ts +2 -0
- package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.d.ts +10 -0
- package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.stories.d.ts +4 -0
- package/dist/slices/FullWidthHighlightQuote/index.d.ts +2 -0
- package/dist/slices/FullWidthImage/FullWidthImage.d.ts +11 -0
- package/dist/slices/FullWidthImage/FullWidthImage.stories.d.ts +5 -0
- package/dist/slices/FullWidthImage/index.d.ts +2 -0
- package/dist/slices/FullWidthImage/styles.d.ts +5 -0
- package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.d.ts +12 -0
- package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.stories.d.ts +3 -0
- package/dist/slices/FullWidthImageSlider/index.d.ts +2 -0
- package/dist/slices/FullWidthImageSlider/styles.d.ts +295 -0
- package/dist/slices/FullWidthImageSlider/utils.d.ts +1 -0
- package/dist/slices/Glossary/Glossary.d.ts +9 -0
- package/dist/slices/Glossary/Glossary.stories.d.ts +3 -0
- package/dist/slices/Glossary/index.d.ts +2 -0
- package/dist/slices/Glossary/messages.de.d.ts +6 -0
- package/dist/slices/Glossary/messages.en.d.ts +6 -0
- package/dist/slices/Hero/Hero.d.ts +17 -0
- package/dist/slices/Hero/Hero.stories.d.ts +9 -0
- package/dist/slices/Hero/index.d.ts +2 -0
- package/dist/slices/Hero/styles.d.ts +17 -0
- package/dist/slices/IconGrid/IconGrid.d.ts +18 -0
- package/dist/slices/IconGrid/IconGrid.stories.d.ts +5 -0
- package/dist/slices/IconGrid/index.d.ts +2 -0
- package/dist/slices/IconGrid/styles.d.ts +9 -0
- package/dist/slices/ImageGrid/ImageGrid.d.ts +18 -0
- package/dist/slices/ImageGrid/ImageGrid.stories.d.ts +5 -0
- package/dist/slices/ImageGrid/index.d.ts +2 -0
- package/dist/slices/ImageGrid/styles.d.ts +5 -0
- package/dist/slices/ImageTextSequence/ImageTextSequence.d.ts +19 -0
- package/dist/slices/ImageTextSequence/ImageTextSequence.stories.d.ts +7 -0
- package/dist/slices/ImageTextSequence/index.d.ts +2 -0
- package/dist/slices/ImageTextSequence/styles.d.ts +13 -0
- package/dist/slices/LeftTextRightCard/LeftTextRightCard.d.ts +17 -0
- package/dist/slices/LeftTextRightCard/LeftTextRightCard.stories.d.ts +8 -0
- package/dist/slices/LeftTextRightCard/index.d.ts +2 -0
- package/dist/slices/LinkCardsGrid/LinkCardsGrid.d.ts +18 -0
- package/dist/slices/LinkCardsGrid/LinkCardsGrid.stories.d.ts +5 -0
- package/dist/slices/LinkCardsGrid/index.d.ts +2 -0
- package/dist/slices/LogoGridWithText/LogoGridWithText.d.ts +12 -0
- package/dist/slices/LogoGridWithText/LogoGridWithText.stories.d.ts +6 -0
- package/dist/slices/LogoGridWithText/index.d.ts +2 -0
- package/dist/slices/LogoGridWithText/styles.d.ts +5 -0
- package/dist/slices/MapHero/MapHero.d.ts +15 -0
- package/dist/slices/MapHero/MapHero.stories.d.ts +8 -0
- package/dist/slices/MapHero/index.d.ts +2 -0
- package/dist/slices/MapHero/styles.d.ts +21 -0
- package/dist/slices/ProjectFacts/ProjectFacts.d.ts +34 -0
- package/dist/slices/ProjectFacts/ProjectFacts.stories.d.ts +6 -0
- package/dist/slices/ProjectFacts/index.d.ts +2 -0
- package/dist/slices/ProjectFacts/messages.de.d.ts +5 -0
- package/dist/slices/ProjectFacts/messages.en.d.ts +5 -0
- package/dist/slices/ProjectsGrid/ProjectsGrid.d.ts +8 -0
- package/dist/slices/ProjectsGrid/ProjectsGrid.stories.d.ts +3 -0
- package/dist/slices/ProjectsGrid/index.d.ts +2 -0
- package/dist/slices/ProjectsMap/MapMarker.d.ts +10 -0
- package/dist/slices/ProjectsMap/ProjectsMap.d.ts +17 -0
- package/dist/slices/ProjectsMap/ProjectsMap.stories.d.ts +6 -0
- package/dist/slices/ProjectsMap/index.d.ts +2 -0
- package/dist/slices/ProjectsMap/messages.de.d.ts +4 -0
- package/dist/slices/ProjectsMap/messages.en.d.ts +4 -0
- package/dist/slices/QAndA/QAndA.d.ts +43 -0
- package/dist/slices/QAndA/QAndA.stories.d.ts +7 -0
- package/dist/slices/QAndA/index.d.ts +2 -0
- package/dist/slices/QuoteCards/QuoteCards.d.ts +15 -0
- package/dist/slices/QuoteCards/QuoteCards.stories.d.ts +8 -0
- package/dist/slices/QuoteCards/index.d.ts +2 -0
- package/dist/slices/QuoteCards/styles.d.ts +13 -0
- package/dist/slices/RichTextSection/RichTextSection.d.ts +7 -0
- package/dist/slices/RichTextSection/RichTextSection.stories.d.ts +3 -0
- package/dist/slices/RichTextSection/index.d.ts +2 -0
- package/dist/slices/ShopCheckout/ShopCheckout.d.ts +16 -0
- package/dist/slices/ShopCheckout/ShopCheckout.stories.d.ts +7 -0
- package/dist/slices/ShopCheckout/index.d.ts +2 -0
- package/dist/slices/ShopCheckout/messages.de.d.ts +15 -0
- package/dist/slices/ShopCheckout/messages.en.d.ts +15 -0
- package/dist/slices/SideBySideImages/SideBySideImages.d.ts +12 -0
- package/dist/slices/SideBySideImages/SideBySideImages.stories.d.ts +3 -0
- package/dist/slices/SideBySideImages/index.d.ts +2 -0
- package/dist/slices/SmallHero/SmallHero.d.ts +20 -0
- package/dist/slices/SmallHero/SmallHero.stories.d.ts +11 -0
- package/dist/slices/SmallHero/index.d.ts +2 -0
- package/dist/slices/SmallHero/styles.d.ts +9 -0
- package/dist/slices/Steps/Steps.d.ts +19 -0
- package/dist/slices/Steps/Steps.stories.d.ts +7 -0
- package/dist/slices/Steps/index.d.ts +2 -0
- package/dist/slices/Steps/styles.d.ts +25 -0
- package/dist/slices/TextCardGrid/TextCardGrid.d.ts +20 -0
- package/dist/slices/TextCardGrid/TextCardGrid.stories.d.ts +8 -0
- package/dist/slices/TextCardGrid/index.d.ts +2 -0
- package/dist/slices/TextCarousel/TextCarousel.d.ts +13 -0
- package/dist/slices/TextCarousel/TextCarousel.stories.d.ts +6 -0
- package/dist/slices/TextCarousel/index.d.ts +2 -0
- package/dist/slices/TextCarousel/styles.d.ts +284 -0
- package/dist/slices/TextWithCard/TextWithCard.d.ts +20 -0
- package/dist/slices/TextWithCard/TextWithCard.stories.d.ts +9 -0
- package/dist/slices/TextWithCard/index.d.ts +2 -0
- package/dist/slices/TextWithTextCards/TextWithTextCards.d.ts +15 -0
- package/dist/slices/TextWithTextCards/TextWithTextCards.stories.d.ts +7 -0
- package/dist/slices/TextWithTextCards/index.d.ts +2 -0
- package/dist/slices/TextWithTextCards/styles.d.ts +5 -0
- package/dist/slices/Video/Video.d.ts +10 -0
- package/dist/slices/Video/Video.stories.d.ts +3 -0
- package/dist/slices/Video/index.d.ts +2 -0
- package/dist/strapi-slices.cjs.development.js +39 -0
- package/dist/strapi-slices.cjs.development.js.map +1 -0
- package/dist/strapi-slices.cjs.production.min.js +2 -0
- package/dist/strapi-slices.cjs.production.min.js.map +1 -0
- package/dist/strapi-slices.esm.js +36 -0
- package/dist/strapi-slices.esm.js.map +1 -0
- package/dist/test/defaultMocks/next.d.ts +2 -0
- package/dist/test/integrationMocks/fpmProjectMock.d.ts +3 -0
- package/dist/test/mocks/portfolioProjectMock.d.ts +3 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/storybookMocks/storybookMedia.d.ts +1 -0
- package/dist/test/storybookMocks/storybookStrapiMedia.d.ts +8 -0
- package/dist/test/strapiMocks/minimalGlobalData.d.ts +4 -0
- package/dist/test/strapiMocks/strapiAvatarWithName.d.ts +12 -0
- package/dist/test/strapiMocks/strapiBlogPost.d.ts +3 -0
- package/dist/test/strapiMocks/strapiContact.d.ts +2 -0
- package/dist/test/strapiMocks/strapiCustomerStory.d.ts +3 -0
- package/dist/test/strapiMocks/strapiHeroCard.d.ts +2 -0
- package/dist/test/strapiMocks/strapiLinkPage.d.ts +3 -0
- package/dist/test/strapiMocks/strapiMedia.d.ts +3 -0
- package/dist/test/strapiMocks/strapiMetadata.d.ts +2 -0
- package/dist/test/strapiMocks/strapiPage.d.ts +3 -0
- package/dist/test/strapiMocks/strapiPortfolioCard.d.ts +2 -0
- package/dist/test/strapiMocks/strapiPortfolioMock.d.ts +3 -0
- package/dist/test/strapiMocks/strapiProject.d.ts +3 -0
- package/dist/test/strapiMocks/strapiProjectCard.d.ts +2 -0
- package/dist/test/strapiMocks/strapiQuoteCard.d.ts +2 -0
- package/dist/test/testUtils.d.ts +6 -0
- package/dist/unit.messages.de.d.ts +5 -0
- package/dist/unit.messages.en.d.ts +5 -0
- package/dist/utils/convertAreaM2ToHa.d.ts +2 -0
- package/dist/utils/convertCo2AmountKgToTons.d.ts +2 -0
- package/dist/utils/convertToKebabCase.d.ts +2 -0
- package/dist/utils/getTimeSpanInYears.d.ts +2 -0
- package/dist/utils/mergeBoundingBoxes.d.ts +3 -0
- package/dist/utils/mergeDeep.d.ts +12 -0
- package/dist/utils/openHubSpotChat.d.ts +2 -0
- package/dist/utils/strapiLinkUrl.d.ts +3 -0
- package/dist/utils/strapiMediaUrl.d.ts +5 -0
- package/package.json +132 -0
- package/src/components/CreditsAvailableBadge/CreditsAvailableBadge.test.tsx +65 -0
- package/src/components/CreditsAvailableBadge/CreditsAvailableBadge.tsx +55 -0
- package/src/components/CreditsAvailableBadge/index.ts +3 -0
- package/src/components/CreditsAvailableBadge/messages.de.ts +7 -0
- package/src/components/CreditsAvailableBadge/messages.en.ts +6 -0
- package/src/components/FullScreenImage/FullScreenImage.test.tsx +45 -0
- package/src/components/FullScreenImage/FullScreenImage.tsx +119 -0
- package/src/components/FullScreenImage/ZoomableImage.tsx +84 -0
- package/src/components/FullScreenImage/index.ts +3 -0
- package/src/components/MinimalProviders/MinimalProviders.tsx +25 -0
- package/src/components/MinimalProviders/index.ts +3 -0
- package/src/components/SliceRenderer/SliceRenderer.test.tsx +35 -0
- package/src/components/SliceRenderer/SliceRenderer.tsx +294 -0
- package/src/components/SliceRenderer/index.ts +3 -0
- package/src/components/StrapiLinkButton/StrapiLinkButton.test.tsx +58 -0
- package/src/components/StrapiLinkButton/StrapiLinkButton.tsx +55 -0
- package/src/components/StrapiLinkButton/index.ts +3 -0
- package/src/components/StrapiLinkButtonWithIcon/StrapiLinkButtonWithIcon.test.tsx +57 -0
- package/src/components/StrapiLinkButtonWithIcon/StrapiLinkButtonWithIcon.tsx +36 -0
- package/src/components/StrapiLinkButtonWithIcon/index.ts +3 -0
- package/src/components/portfolio/Contact/Contact.test.tsx +51 -0
- package/src/components/portfolio/Contact/Contact.tsx +73 -0
- package/src/components/portfolio/Contact/index.ts +3 -0
- package/src/components/portfolio/DocumentsDownloadList/DocumentsDownloadList.test.tsx +49 -0
- package/src/components/portfolio/DocumentsDownloadList/DocumentsDownloadList.tsx +76 -0
- package/src/components/portfolio/DocumentsDownloadList/index.ts +3 -0
- package/src/components/portfolio/DocumentsDownloadList/messages.de.ts +6 -0
- package/src/components/portfolio/DocumentsDownloadList/messages.en.ts +6 -0
- package/src/components/portfolio/ProjectInfo/ProjectInfo.test.tsx +81 -0
- package/src/components/portfolio/ProjectInfo/ProjectInfo.tsx +252 -0
- package/src/components/portfolio/ProjectInfo/index.ts +3 -0
- package/src/components/portfolio/ProjectInfo/messages.de.ts +19 -0
- package/src/components/portfolio/ProjectInfo/messages.en.ts +19 -0
- package/src/components/portfolio/SmallCheckout/SmallCheckout.test.tsx +166 -0
- package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +265 -0
- package/src/components/portfolio/SmallCheckout/index.ts +3 -0
- package/src/components/portfolio/SmallCheckout/messages.de.ts +26 -0
- package/src/components/portfolio/SmallCheckout/messages.en.ts +26 -0
- package/src/constants/animations.ts +1 -0
- package/src/constants/api.ts +5 -0
- package/src/constants/breakpoints.ts +9 -0
- package/src/constants/domain.ts +3 -0
- package/src/constants/fontCustomizations.ts +6 -0
- package/src/constants/formatter.ts +29 -0
- package/src/constants/globalStyle.ts +55 -0
- package/src/constants/mapbox.ts +24 -0
- package/src/constants/strapi.ts +2 -0
- package/src/icons/LinkedInIcon.tsx +23 -0
- package/src/index.tsx +1 -0
- package/src/models/BBox.ts +3 -0
- package/src/models/CreditsAvailableState.ts +8 -0
- package/src/models/Locale.ts +3 -0
- package/src/models/PortfolioProject.ts +9 -0
- package/src/models/forms/CheckoutForm.ts +5 -0
- package/src/models/fpm/FPMProject.ts +41 -0
- package/src/models/fpm/Issuer.ts +7 -0
- package/src/models/strapi/IStrapi.ts +5 -0
- package/src/models/strapi/IStrapiData.ts +6 -0
- package/src/models/strapi/IStrapiResponse.ts +15 -0
- package/src/models/strapi/StrapiAuthor.ts +12 -0
- package/src/models/strapi/StrapiAvatarWithName.ts +10 -0
- package/src/models/strapi/StrapiBanner.ts +11 -0
- package/src/models/strapi/StrapiBlogPost.ts +27 -0
- package/src/models/strapi/StrapiButtonWithVariant.ts +8 -0
- package/src/models/strapi/StrapiCategory.ts +10 -0
- package/src/models/strapi/StrapiContactArea.ts +12 -0
- package/src/models/strapi/StrapiCustomerStory.ts +23 -0
- package/src/models/strapi/StrapiDefaultHeader.ts +7 -0
- package/src/models/strapi/StrapiGlobal.ts +28 -0
- package/src/models/strapi/StrapiGlossaryItem.ts +7 -0
- package/src/models/strapi/StrapiHeroCard.ts +15 -0
- package/src/models/strapi/StrapiImage.ts +12 -0
- package/src/models/strapi/StrapiImageFormat.ts +13 -0
- package/src/models/strapi/StrapiImageWithLink.ts +8 -0
- package/src/models/strapi/StrapiLink.ts +13 -0
- package/src/models/strapi/StrapiLinkList.ts +9 -0
- package/src/models/strapi/StrapiLinkPage.ts +12 -0
- package/src/models/strapi/StrapiLinkWithIcon.ts +9 -0
- package/src/models/strapi/StrapiLocalization.ts +9 -0
- package/src/models/strapi/StrapiMedia.ts +29 -0
- package/src/models/strapi/StrapiMetadata.ts +15 -0
- package/src/models/strapi/StrapiNavMenu.ts +16 -0
- package/src/models/strapi/StrapiPage.ts +19 -0
- package/src/models/strapi/StrapiPortfolio.ts +12 -0
- package/src/models/strapi/StrapiPortfolioCard.ts +17 -0
- package/src/models/strapi/StrapiProject.ts +25 -0
- package/src/models/strapi/StrapiProjectCard.ts +20 -0
- package/src/models/strapi/StrapiQuoteCard.ts +9 -0
- package/src/models/strapi/StrapiShapesCard.ts +13 -0
- package/src/models/strapi/StrapiTextCardWithIcons.ts +10 -0
- package/src/models/strapi/StrapiTopBanner.ts +9 -0
- package/src/rootMessages.de.ts +41 -0
- package/src/rootMessages.en.ts +41 -0
- package/src/slices/Blog/Blog.test.tsx +146 -0
- package/src/slices/Blog/Blog.tsx +114 -0
- package/src/slices/Blog/index.ts +3 -0
- package/src/slices/Blog/styles.ts +34 -0
- package/src/slices/BlogCards/BlogCards.stories.tsx +148 -0
- package/src/slices/BlogCards/BlogCards.test.tsx +277 -0
- package/src/slices/BlogCards/BlogCards.tsx +210 -0
- package/src/slices/BlogCards/index.ts +3 -0
- package/src/slices/Comparison/Comparison.stories.tsx +123 -0
- package/src/slices/Comparison/Comparison.test.tsx +173 -0
- package/src/slices/Comparison/Comparison.tsx +265 -0
- package/src/slices/Comparison/Icon.test.tsx +43 -0
- package/src/slices/Comparison/Icon.tsx +34 -0
- package/src/slices/Comparison/index.ts +3 -0
- package/src/slices/Comparison/messages.de.ts +3 -0
- package/src/slices/Comparison/messages.en.ts +3 -0
- package/src/slices/Cta/Cta.stories.tsx +149 -0
- package/src/slices/Cta/Cta.test.tsx +249 -0
- package/src/slices/Cta/Cta.tsx +412 -0
- package/src/slices/Cta/index.ts +3 -0
- package/src/slices/Cta/messages.de.ts +4 -0
- package/src/slices/Cta/messages.en.ts +4 -0
- package/src/slices/CtaOnly/CtaOnly.stories.tsx +47 -0
- package/src/slices/CtaOnly/CtaOnly.test.tsx +26 -0
- package/src/slices/CtaOnly/CtaOnly.tsx +17 -0
- package/src/slices/CtaOnly/index.ts +3 -0
- package/src/slices/CustomerStories/CustomerStories.stories.tsx +20 -0
- package/src/slices/CustomerStories/CustomerStories.test.tsx +43 -0
- package/src/slices/CustomerStories/CustomerStories.tsx +84 -0
- package/src/slices/CustomerStories/index.ts +3 -0
- package/src/slices/CustomerStories/messages.de.ts +3 -0
- package/src/slices/CustomerStories/messages.en.ts +3 -0
- package/src/slices/Facts/Facts.stories.tsx +97 -0
- package/src/slices/Facts/Facts.test.tsx +99 -0
- package/src/slices/Facts/Facts.tsx +140 -0
- package/src/slices/Facts/index.ts +3 -0
- package/src/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.stories.tsx +41 -0
- package/src/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.test.tsx +39 -0
- package/src/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.tsx +57 -0
- package/src/slices/FullWidthHighlightQuote/index.ts +3 -0
- package/src/slices/FullWidthImage/FullWidthImage.stories.tsx +40 -0
- package/src/slices/FullWidthImage/FullWidthImage.test.tsx +33 -0
- package/src/slices/FullWidthImage/FullWidthImage.tsx +63 -0
- package/src/slices/FullWidthImage/index.ts +3 -0
- package/src/slices/FullWidthImage/styles.ts +17 -0
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.stories.tsx +75 -0
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.test.tsx +49 -0
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.tsx +149 -0
- package/src/slices/FullWidthImageSlider/index.ts +3 -0
- package/src/slices/FullWidthImageSlider/styles.ts +96 -0
- package/src/slices/FullWidthImageSlider/utils.test.ts +10 -0
- package/src/slices/FullWidthImageSlider/utils.ts +17 -0
- package/src/slices/Glossary/Glossary.stories.tsx +42 -0
- package/src/slices/Glossary/Glossary.test.tsx +102 -0
- package/src/slices/Glossary/Glossary.tsx +107 -0
- package/src/slices/Glossary/index.ts +3 -0
- package/src/slices/Glossary/messages.de.ts +7 -0
- package/src/slices/Glossary/messages.en.ts +6 -0
- package/src/slices/Hero/Hero.stories.tsx +129 -0
- package/src/slices/Hero/Hero.test.tsx +89 -0
- package/src/slices/Hero/Hero.tsx +95 -0
- package/src/slices/Hero/index.ts +3 -0
- package/src/slices/Hero/styles.ts +52 -0
- package/src/slices/IconGrid/IconGrid.stories.tsx +178 -0
- package/src/slices/IconGrid/IconGrid.test.tsx +81 -0
- package/src/slices/IconGrid/IconGrid.tsx +97 -0
- package/src/slices/IconGrid/index.ts +3 -0
- package/src/slices/IconGrid/styles.ts +21 -0
- package/src/slices/ImageGrid/ImageGrid.stories.tsx +92 -0
- package/src/slices/ImageGrid/ImageGrid.test.tsx +82 -0
- package/src/slices/ImageGrid/ImageGrid.tsx +89 -0
- package/src/slices/ImageGrid/index.ts +3 -0
- package/src/slices/ImageGrid/styles.ts +12 -0
- package/src/slices/ImageTextSequence/ImageTextSequence.stories.tsx +124 -0
- package/src/slices/ImageTextSequence/ImageTextSequence.test.tsx +91 -0
- package/src/slices/ImageTextSequence/ImageTextSequence.tsx +143 -0
- package/src/slices/ImageTextSequence/index.ts +3 -0
- package/src/slices/ImageTextSequence/styles.ts +33 -0
- package/src/slices/LeftTextRightCard/LeftTextRightCard.stories.tsx +93 -0
- package/src/slices/LeftTextRightCard/LeftTextRightCard.test.tsx +72 -0
- package/src/slices/LeftTextRightCard/LeftTextRightCard.tsx +108 -0
- package/src/slices/LeftTextRightCard/index.ts +3 -0
- package/src/slices/LinkCardsGrid/LinkCardsGrid.stories.tsx +60 -0
- package/src/slices/LinkCardsGrid/LinkCardsGrid.test.tsx +36 -0
- package/src/slices/LinkCardsGrid/LinkCardsGrid.tsx +95 -0
- package/src/slices/LinkCardsGrid/index.ts +3 -0
- package/src/slices/LogoGridWithText/LogoGridWithText.stories.tsx +73 -0
- package/src/slices/LogoGridWithText/LogoGridWithText.test.tsx +55 -0
- package/src/slices/LogoGridWithText/LogoGridWithText.tsx +95 -0
- package/src/slices/LogoGridWithText/index.ts +3 -0
- package/src/slices/LogoGridWithText/styles.ts +13 -0
- package/src/slices/MapHero/MapHero.stories.tsx +112 -0
- package/src/slices/MapHero/MapHero.test.tsx +85 -0
- package/src/slices/MapHero/MapHero.tsx +89 -0
- package/src/slices/MapHero/index.ts +3 -0
- package/src/slices/MapHero/styles.ts +105 -0
- package/src/slices/ProjectFacts/ProjectFacts.stories.tsx +91 -0
- package/src/slices/ProjectFacts/ProjectFacts.test.tsx +34 -0
- package/src/slices/ProjectFacts/ProjectFacts.tsx +95 -0
- package/src/slices/ProjectFacts/index.ts +3 -0
- package/src/slices/ProjectFacts/messages.de.ts +4 -0
- package/src/slices/ProjectFacts/messages.en.ts +4 -0
- package/src/slices/ProjectsGrid/ProjectsGrid.stories.tsx +72 -0
- package/src/slices/ProjectsGrid/ProjectsGrid.test.tsx +31 -0
- package/src/slices/ProjectsGrid/ProjectsGrid.tsx +80 -0
- package/src/slices/ProjectsGrid/index.ts +3 -0
- package/src/slices/ProjectsMap/MapMarker.test.tsx +79 -0
- package/src/slices/ProjectsMap/MapMarker.tsx +99 -0
- package/src/slices/ProjectsMap/ProjectsMap.stories.tsx +101 -0
- package/src/slices/ProjectsMap/ProjectsMap.test.tsx +95 -0
- package/src/slices/ProjectsMap/ProjectsMap.tsx +150 -0
- package/src/slices/ProjectsMap/index.ts +3 -0
- package/src/slices/ProjectsMap/messages.de.ts +3 -0
- package/src/slices/ProjectsMap/messages.en.ts +3 -0
- package/src/slices/QAndA/QAndA.stories.tsx +103 -0
- package/src/slices/QAndA/QAndA.test.tsx +67 -0
- package/src/slices/QAndA/QAndA.tsx +157 -0
- package/src/slices/QAndA/index.ts +3 -0
- package/src/slices/QuoteCards/QuoteCards.stories.tsx +118 -0
- package/src/slices/QuoteCards/QuoteCards.test.tsx +52 -0
- package/src/slices/QuoteCards/QuoteCards.tsx +135 -0
- package/src/slices/QuoteCards/index.ts +3 -0
- package/src/slices/QuoteCards/styles.ts +17 -0
- package/src/slices/RichTextSection/RichTextSection.stories.tsx +27 -0
- package/src/slices/RichTextSection/RichTextSection.test.tsx +20 -0
- package/src/slices/RichTextSection/RichTextSection.tsx +27 -0
- package/src/slices/RichTextSection/index.ts +3 -0
- package/src/slices/ShopCheckout/ShopCheckout.stories.tsx +76 -0
- package/src/slices/ShopCheckout/ShopCheckout.test.tsx +186 -0
- package/src/slices/ShopCheckout/ShopCheckout.tsx +228 -0
- package/src/slices/ShopCheckout/index.ts +3 -0
- package/src/slices/ShopCheckout/messages.de.ts +23 -0
- package/src/slices/ShopCheckout/messages.en.ts +23 -0
- package/src/slices/SideBySideImages/SideBySideImages.stories.tsx +39 -0
- package/src/slices/SideBySideImages/SideBySideImages.test.tsx +52 -0
- package/src/slices/SideBySideImages/SideBySideImages.tsx +57 -0
- package/src/slices/SideBySideImages/index.ts +3 -0
- package/src/slices/SmallHero/SmallHero.stories.tsx +138 -0
- package/src/slices/SmallHero/SmallHero.test.tsx +70 -0
- package/src/slices/SmallHero/SmallHero.tsx +116 -0
- package/src/slices/SmallHero/index.ts +3 -0
- package/src/slices/SmallHero/styles.ts +39 -0
- package/src/slices/Steps/Steps.stories.tsx +95 -0
- package/src/slices/Steps/Steps.test.tsx +68 -0
- package/src/slices/Steps/Steps.tsx +178 -0
- package/src/slices/Steps/index.ts +3 -0
- package/src/slices/Steps/styles.ts +64 -0
- package/src/slices/TextCardGrid/TextCardGrid.stories.tsx +156 -0
- package/src/slices/TextCardGrid/TextCardGrid.test.tsx +103 -0
- package/src/slices/TextCardGrid/TextCardGrid.tsx +285 -0
- package/src/slices/TextCardGrid/index.ts +3 -0
- package/src/slices/TextCarousel/TextCarousel.stories.tsx +104 -0
- package/src/slices/TextCarousel/TextCarousel.test.tsx +90 -0
- package/src/slices/TextCarousel/TextCarousel.tsx +91 -0
- package/src/slices/TextCarousel/index.ts +3 -0
- package/src/slices/TextCarousel/styles.ts +65 -0
- package/src/slices/TextWithCard/TextWithCard.stories.tsx +113 -0
- package/src/slices/TextWithCard/TextWithCard.test.tsx +87 -0
- package/src/slices/TextWithCard/TextWithCard.tsx +115 -0
- package/src/slices/TextWithCard/index.ts +3 -0
- package/src/slices/TextWithTextCards/TextWithTextCards.stories.tsx +121 -0
- package/src/slices/TextWithTextCards/TextWithTextCards.test.tsx +57 -0
- package/src/slices/TextWithTextCards/TextWithTextCards.tsx +167 -0
- package/src/slices/TextWithTextCards/index.ts +3 -0
- package/src/slices/TextWithTextCards/styles.ts +26 -0
- package/src/slices/Video/Video.stories.tsx +18 -0
- package/src/slices/Video/Video.test.tsx +26 -0
- package/src/slices/Video/Video.tsx +35 -0
- package/src/slices/Video/index.ts +3 -0
- package/src/test/defaultMocks/next.ts +29 -0
- package/src/test/integrationMocks/fpmProjectMock.ts +37 -0
- package/src/test/mocks/portfolioProjectMock.ts +11 -0
- package/src/test/setupTests.ts +5 -0
- package/src/test/storybookMocks/storybookMedia.ts +2 -0
- package/src/test/storybookMocks/storybookStrapiMedia.ts +58 -0
- package/src/test/strapiMocks/minimalGlobalData.ts +24 -0
- package/src/test/strapiMocks/strapiAvatarWithName.ts +12 -0
- package/src/test/strapiMocks/strapiBlogPost.ts +216 -0
- package/src/test/strapiMocks/strapiContact.ts +15 -0
- package/src/test/strapiMocks/strapiCustomerStory.ts +195 -0
- package/src/test/strapiMocks/strapiHeroCard.ts +7 -0
- package/src/test/strapiMocks/strapiLinkPage.ts +14 -0
- package/src/test/strapiMocks/strapiMedia.ts +91 -0
- package/src/test/strapiMocks/strapiMetadata.ts +12 -0
- package/src/test/strapiMocks/strapiPage.ts +683 -0
- package/src/test/strapiMocks/strapiPortfolioCard.ts +40 -0
- package/src/test/strapiMocks/strapiPortfolioMock.ts +20 -0
- package/src/test/strapiMocks/strapiProject.ts +34 -0
- package/src/test/strapiMocks/strapiProjectCard.ts +20 -0
- package/src/test/strapiMocks/strapiQuoteCard.ts +8 -0
- package/src/test/testUtils.tsx +25 -0
- package/src/unit.messages.de.ts +4 -0
- package/src/unit.messages.en.ts +4 -0
- package/src/utils/convertAreaM2ToHa.test.ts +9 -0
- package/src/utils/convertAreaM2ToHa.ts +4 -0
- package/src/utils/convertCo2AmountKgToTons.ts +4 -0
- package/src/utils/convertToKebabCase.test.ts +9 -0
- package/src/utils/convertToKebabCase.ts +10 -0
- package/src/utils/getTimeSpanInYears.test.ts +35 -0
- package/src/utils/getTimeSpanInYears.ts +14 -0
- package/src/utils/mergeBoundingBoxes.test.ts +13 -0
- package/src/utils/mergeBoundingBoxes.ts +19 -0
- package/src/utils/mergeDeep.ts +31 -0
- package/src/utils/openHubSpotChat.ts +15 -0
- package/src/utils/strapiLinkUrl.test.ts +26 -0
- package/src/utils/strapiLinkUrl.ts +13 -0
- package/src/utils/strapiMediaUrl.test.ts +54 -0
- package/src/utils/strapiMediaUrl.ts +32 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { fireEvent, render, screen, waitFor } from '@/test/testUtils';
|
|
2
|
+
import CreditsAvailableState from '@/models/CreditsAvailableState';
|
|
3
|
+
import MapMarker, { MapMarkerProps } from './MapMarker';
|
|
4
|
+
import messagesEn from './messages.en';
|
|
5
|
+
|
|
6
|
+
const defaultProps: MapMarkerProps = {
|
|
7
|
+
title: 'Project title',
|
|
8
|
+
isPublic: true,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const setup = (props: Partial<MapMarkerProps> = {}) => {
|
|
12
|
+
const combinedProps = { ...defaultProps, ...props };
|
|
13
|
+
render(<MapMarker {...combinedProps} />);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
describe('The MapMarker component', () => {
|
|
17
|
+
it('renders successfully with minimal props', () => {
|
|
18
|
+
setup({});
|
|
19
|
+
|
|
20
|
+
expect(screen.queryByText('Project title')).not.toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders successfully with minimal props', () => {
|
|
24
|
+
setup({});
|
|
25
|
+
|
|
26
|
+
fireEvent.mouseEnter(screen.getByTestId('mapmarker-pin'));
|
|
27
|
+
|
|
28
|
+
waitFor(() => {
|
|
29
|
+
expect(screen.findByText('Project title')).toBeInTheDocument();
|
|
30
|
+
expect(screen.findByRole('button')).not.toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders a button if slug is defined', () => {
|
|
35
|
+
setup({ slug: 'slug' });
|
|
36
|
+
|
|
37
|
+
expect(screen.getByTestId('mapmarker-pin').parentElement).toHaveProperty(
|
|
38
|
+
'href',
|
|
39
|
+
expect.stringContaining('/portfolio/slug')
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
fireEvent.mouseEnter(screen.getByTestId('mapmarker-pin'));
|
|
43
|
+
|
|
44
|
+
waitFor(() => {
|
|
45
|
+
const button = screen.getByText(
|
|
46
|
+
messagesEn['sections.projectsMap.link.text']
|
|
47
|
+
);
|
|
48
|
+
expect(button).toBeInTheDocument();
|
|
49
|
+
expect(button).toHaveProperty(
|
|
50
|
+
'href',
|
|
51
|
+
expect.stringContaining('/portfolio/slug')
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('renders the project developer if it is defined', () => {
|
|
57
|
+
setup({
|
|
58
|
+
projectDeveloper: 'Project developer',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
fireEvent.mouseEnter(screen.getByTestId('mapmarker-pin'));
|
|
62
|
+
|
|
63
|
+
waitFor(() => {
|
|
64
|
+
expect(screen.getByText('Project developer')).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('renders the credit availability if it is defined', () => {
|
|
69
|
+
setup({
|
|
70
|
+
creditsAvailable: CreditsAvailableState.YES,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
fireEvent.mouseEnter(screen.getByTestId('mapmarker-pin'));
|
|
74
|
+
|
|
75
|
+
waitFor(() => {
|
|
76
|
+
expect(screen.getByText('CREDITS AVAILABLE')).toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
4
|
+
Container,
|
|
5
|
+
Flex,
|
|
6
|
+
Heading,
|
|
7
|
+
Text,
|
|
8
|
+
useDisclosure,
|
|
9
|
+
useToken,
|
|
10
|
+
} from 'boemly';
|
|
11
|
+
import { MapPin } from '@phosphor-icons/react';
|
|
12
|
+
import NextLink from 'next/link';
|
|
13
|
+
import CreditsAvailableBadge from '@/components/CreditsAvailableBadge';
|
|
14
|
+
import CreditsAvailableState from '@/models/CreditsAvailableState';
|
|
15
|
+
import { FormattedMessage } from 'react-intl';
|
|
16
|
+
|
|
17
|
+
export interface MapMarkerProps {
|
|
18
|
+
title: string;
|
|
19
|
+
isPublic?: boolean;
|
|
20
|
+
projectDeveloper?: string;
|
|
21
|
+
slug?: string;
|
|
22
|
+
creditsAvailable?: CreditsAvailableState;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const MapMarker = ({
|
|
26
|
+
title,
|
|
27
|
+
projectDeveloper,
|
|
28
|
+
slug,
|
|
29
|
+
creditsAvailable,
|
|
30
|
+
isPublic = false,
|
|
31
|
+
}: MapMarkerProps) => {
|
|
32
|
+
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
33
|
+
const blue600 = useToken('colors', 'blue.600');
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Flex
|
|
37
|
+
position="absolute"
|
|
38
|
+
gap="4"
|
|
39
|
+
onMouseEnter={onOpen}
|
|
40
|
+
onMouseLeave={onClose}
|
|
41
|
+
cursor="grab"
|
|
42
|
+
>
|
|
43
|
+
<Box as={slug ? NextLink : undefined} href={slug && `/portfolio/${slug}`}>
|
|
44
|
+
<MapPin
|
|
45
|
+
size="40px"
|
|
46
|
+
color={blue600}
|
|
47
|
+
weight="fill"
|
|
48
|
+
data-testid="mapmarker-pin"
|
|
49
|
+
filter="drop-shadow(0px 0px 2px #FFF)"
|
|
50
|
+
/>
|
|
51
|
+
</Box>
|
|
52
|
+
|
|
53
|
+
{isPublic && isOpen && (
|
|
54
|
+
<Container
|
|
55
|
+
shadow="md"
|
|
56
|
+
width="max-content"
|
|
57
|
+
minWidth="3xs"
|
|
58
|
+
maxWidth={['3xs', null, null, 'sm']}
|
|
59
|
+
>
|
|
60
|
+
<Flex direction="column">
|
|
61
|
+
{creditsAvailable && (
|
|
62
|
+
<>
|
|
63
|
+
<CreditsAvailableBadge
|
|
64
|
+
status={creditsAvailable}
|
|
65
|
+
href={slug && `/portfolio/${slug}`}
|
|
66
|
+
/>
|
|
67
|
+
<Box height="3" />
|
|
68
|
+
</>
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
<Heading size="md">{title}</Heading>
|
|
72
|
+
|
|
73
|
+
{projectDeveloper && (
|
|
74
|
+
<Text size="smLowNormal" mt="1">
|
|
75
|
+
{projectDeveloper}
|
|
76
|
+
</Text>
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
{slug && (
|
|
80
|
+
<Button
|
|
81
|
+
width="fit-content"
|
|
82
|
+
variant="outline"
|
|
83
|
+
size="sm"
|
|
84
|
+
as={NextLink}
|
|
85
|
+
href={`/portfolio/${slug}`}
|
|
86
|
+
mt="4"
|
|
87
|
+
whiteSpace="nowrap"
|
|
88
|
+
>
|
|
89
|
+
<FormattedMessage id="sections.projectsMap.link.text" />
|
|
90
|
+
</Button>
|
|
91
|
+
)}
|
|
92
|
+
</Flex>
|
|
93
|
+
</Container>
|
|
94
|
+
)}
|
|
95
|
+
</Flex>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default MapMarker;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import fpmProjectMock from '@/test/integrationMocks/fpmProjectMock';
|
|
4
|
+
import CreditsAvailableState from '@/models/CreditsAvailableState';
|
|
5
|
+
import ProjectsMap from '.';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'sections/ProjectsMap',
|
|
9
|
+
component: ProjectsMap,
|
|
10
|
+
} as Meta<typeof ProjectsMap>;
|
|
11
|
+
|
|
12
|
+
const Template: StoryFn<typeof ProjectsMap> = (args) => (
|
|
13
|
+
<ProjectsMap {...args} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Minimal = Template.bind({});
|
|
17
|
+
Minimal.args = {
|
|
18
|
+
slice: {},
|
|
19
|
+
projects: [
|
|
20
|
+
fpmProjectMock,
|
|
21
|
+
{
|
|
22
|
+
isPublic: true,
|
|
23
|
+
...fpmProjectMock,
|
|
24
|
+
geom: {
|
|
25
|
+
type: 'Point',
|
|
26
|
+
coordinates: [10.336542145100883, 47.82636837845707],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const WithHero = Template.bind({});
|
|
33
|
+
WithHero.args = {
|
|
34
|
+
slice: {
|
|
35
|
+
tagline: 'Projects Map Tagline',
|
|
36
|
+
text: 'Projects Map Text',
|
|
37
|
+
title: 'Projects Map Title',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
projects: [
|
|
41
|
+
fpmProjectMock,
|
|
42
|
+
{
|
|
43
|
+
isPublic: true,
|
|
44
|
+
...fpmProjectMock,
|
|
45
|
+
geom: {
|
|
46
|
+
type: 'Point',
|
|
47
|
+
coordinates: [10.336542145100883, 47.82636837845707],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const InitialPosition = Template.bind({});
|
|
54
|
+
InitialPosition.args = {
|
|
55
|
+
slice: {
|
|
56
|
+
defaultCenterCoordinates: {
|
|
57
|
+
latitude: 47.42636837845707,
|
|
58
|
+
longitude: 10.036542145100883,
|
|
59
|
+
},
|
|
60
|
+
defaultZoomLevel: 10,
|
|
61
|
+
},
|
|
62
|
+
projects: [
|
|
63
|
+
fpmProjectMock,
|
|
64
|
+
{
|
|
65
|
+
...fpmProjectMock,
|
|
66
|
+
isPublic: true,
|
|
67
|
+
geom: {
|
|
68
|
+
type: 'Point',
|
|
69
|
+
coordinates: [10.336542145100883, 47.82636837845707],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const FullProps = Template.bind({});
|
|
76
|
+
FullProps.args = {
|
|
77
|
+
slice: {
|
|
78
|
+
tagline: 'Projects Map Tagline',
|
|
79
|
+
text: 'Projects Map Text',
|
|
80
|
+
title: 'Projects Map Title',
|
|
81
|
+
|
|
82
|
+
defaultCenterCoordinates: {
|
|
83
|
+
latitude: 47.82636837845707,
|
|
84
|
+
longitude: 10.336542145100883,
|
|
85
|
+
},
|
|
86
|
+
defaultZoomLevel: 10,
|
|
87
|
+
},
|
|
88
|
+
projects: [
|
|
89
|
+
fpmProjectMock,
|
|
90
|
+
{
|
|
91
|
+
...fpmProjectMock,
|
|
92
|
+
slug: 'project-slug',
|
|
93
|
+
creditsAvailable: CreditsAvailableState.YES,
|
|
94
|
+
isPublic: true,
|
|
95
|
+
geom: {
|
|
96
|
+
type: 'Point',
|
|
97
|
+
coordinates: [10.336542145100883, 47.82636837845707],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { render, screen } from '@/test/testUtils';
|
|
2
|
+
import fpmProjectMock from '@/test/integrationMocks/fpmProjectMock';
|
|
3
|
+
import { MAPBOX_INITIAL_ZOOM } from '@/constants/mapbox';
|
|
4
|
+
import ProjectsMap from '.';
|
|
5
|
+
import { ProjectsMapProps } from './ProjectsMap';
|
|
6
|
+
import {
|
|
7
|
+
markerSetLngLatSpy,
|
|
8
|
+
markerAddToSpy,
|
|
9
|
+
mapConstructorMock,
|
|
10
|
+
} from '../../../__mocks__/mapbox-gl';
|
|
11
|
+
|
|
12
|
+
const defaultProps: ProjectsMapProps = {
|
|
13
|
+
slice: {},
|
|
14
|
+
projects: [],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const setup = (props = {}) => {
|
|
18
|
+
const combinedProps = { ...defaultProps, ...props };
|
|
19
|
+
render(<ProjectsMap {...combinedProps} />);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
describe('The ProjectsMap component', () => {
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
markerSetLngLatSpy.mockClear();
|
|
25
|
+
markerAddToSpy.mockClear();
|
|
26
|
+
mapConstructorMock.mockClear();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders successfully with minimal props', () => {
|
|
30
|
+
setup({});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('renders the title, tagline and text', () => {
|
|
34
|
+
setup({
|
|
35
|
+
slice: {
|
|
36
|
+
title: 'title',
|
|
37
|
+
tagline: 'tagline',
|
|
38
|
+
text: 'text',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
expect(screen.getByText('title')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText('tagline')).toBeInTheDocument();
|
|
44
|
+
expect(screen.getByText('text')).toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('adds the projects to the map', () => {
|
|
48
|
+
setup({
|
|
49
|
+
projects: [fpmProjectMock],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(markerSetLngLatSpy).toHaveBeenCalledWith(
|
|
53
|
+
fpmProjectMock.geom?.coordinates
|
|
54
|
+
);
|
|
55
|
+
expect(markerAddToSpy).toHaveBeenCalledTimes(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('sets the center to the bounding box of the projects coordinates by default', () => {
|
|
59
|
+
setup({
|
|
60
|
+
projects: [fpmProjectMock],
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
expect(mapConstructorMock).toHaveBeenCalledWith(
|
|
64
|
+
expect.objectContaining({
|
|
65
|
+
bounds: [
|
|
66
|
+
9.836542145100884, 47.22636837845707, 10.236542145100882,
|
|
67
|
+
47.62636837845707,
|
|
68
|
+
],
|
|
69
|
+
center: undefined,
|
|
70
|
+
zoom: MAPBOX_INITIAL_ZOOM,
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('sets the and zoom to the specified ones if they are provided', () => {
|
|
76
|
+
setup({
|
|
77
|
+
slice: {
|
|
78
|
+
defaultCenterCoordinates: {
|
|
79
|
+
latitude: 13,
|
|
80
|
+
longitude: 23,
|
|
81
|
+
},
|
|
82
|
+
defaultZoomLevel: 7,
|
|
83
|
+
},
|
|
84
|
+
projects: [fpmProjectMock],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(mapConstructorMock).toHaveBeenCalledWith(
|
|
88
|
+
expect.objectContaining({
|
|
89
|
+
bounds: undefined,
|
|
90
|
+
center: [23, 13],
|
|
91
|
+
zoom: 7,
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAPBOX_INITIAL_ZOOM,
|
|
3
|
+
MAPBOX_MAX_ZOOM,
|
|
4
|
+
MAPBOX_TOKEN,
|
|
5
|
+
MapBoxStyle,
|
|
6
|
+
} from '@/constants/mapbox';
|
|
7
|
+
import { useIntl } from 'react-intl';
|
|
8
|
+
import BBox from '@/models/BBox';
|
|
9
|
+
import mergeBoundingBoxes from '@/utils/mergeBoundingBoxes';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import {
|
|
12
|
+
Box,
|
|
13
|
+
DefaultSectionContainer,
|
|
14
|
+
DefaultSectionHeader,
|
|
15
|
+
Wrapper,
|
|
16
|
+
} from 'boemly';
|
|
17
|
+
import mapboxgl, { LngLatBoundsLike, LngLatLike, Map, Marker } from 'mapbox-gl';
|
|
18
|
+
import { MutableRefObject, createRef, useEffect, useRef } from 'react';
|
|
19
|
+
import { createRoot } from 'react-dom/client';
|
|
20
|
+
import PortfolioProject from '@/models/PortfolioProject';
|
|
21
|
+
import MinimalProviders from '@/components/MinimalProviders';
|
|
22
|
+
import MapMarker from './MapMarker';
|
|
23
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
24
|
+
|
|
25
|
+
mapboxgl.accessToken = 'MAPBOX_TOKEN';
|
|
26
|
+
|
|
27
|
+
export interface ProjectsMapProps {
|
|
28
|
+
slice: {
|
|
29
|
+
tagline?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
text?: string;
|
|
32
|
+
|
|
33
|
+
defaultCenterCoordinates?: {
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
};
|
|
37
|
+
defaultZoomLevel?: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
projects: PortfolioProject[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const ProjectsMap: React.FC<ProjectsMapProps> = ({
|
|
44
|
+
slice,
|
|
45
|
+
projects,
|
|
46
|
+
}: ProjectsMapProps) => {
|
|
47
|
+
const { locale } = useIntl();
|
|
48
|
+
|
|
49
|
+
const filteredProjects = projects.filter(
|
|
50
|
+
(project) => project.geom
|
|
51
|
+
) as (PortfolioProject & {
|
|
52
|
+
geom: Pick<PortfolioProject, 'geom'>;
|
|
53
|
+
})[];
|
|
54
|
+
|
|
55
|
+
const center: LngLatLike | undefined = slice.defaultCenterCoordinates
|
|
56
|
+
? [
|
|
57
|
+
slice.defaultCenterCoordinates.longitude,
|
|
58
|
+
slice.defaultCenterCoordinates.latitude,
|
|
59
|
+
]
|
|
60
|
+
: undefined;
|
|
61
|
+
|
|
62
|
+
const bounds: LngLatBoundsLike | undefined = center
|
|
63
|
+
? undefined
|
|
64
|
+
: mergeBoundingBoxes(
|
|
65
|
+
filteredProjects.map(
|
|
66
|
+
(p): BBox =>
|
|
67
|
+
[
|
|
68
|
+
...p.geom.coordinates.map((c) => c - 0.2),
|
|
69
|
+
...p.geom.coordinates.map((c) => c + 0.2),
|
|
70
|
+
] as BBox
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const mapContainer = useRef<HTMLDivElement>(null);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const map = new Map({
|
|
78
|
+
container: mapContainer.current || '',
|
|
79
|
+
style: MapBoxStyle.CaliTerrain,
|
|
80
|
+
center,
|
|
81
|
+
zoom: slice.defaultZoomLevel || MAPBOX_INITIAL_ZOOM,
|
|
82
|
+
maxZoom: MAPBOX_MAX_ZOOM,
|
|
83
|
+
bounds,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
filteredProjects
|
|
87
|
+
// Sort by longitude, so that the markers are rendeed form right to left
|
|
88
|
+
.sort((a, b) => b.geom.coordinates[0] - a.geom.coordinates[0])
|
|
89
|
+
.forEach((project) => {
|
|
90
|
+
const ref =
|
|
91
|
+
createRef<HTMLDivElement>() as MutableRefObject<HTMLDivElement>;
|
|
92
|
+
ref.current = document.createElement('div');
|
|
93
|
+
|
|
94
|
+
createRoot(ref.current).render(
|
|
95
|
+
<MinimalProviders locale={locale}>
|
|
96
|
+
<MapMarker
|
|
97
|
+
title={project.title}
|
|
98
|
+
isPublic={project.isPublic}
|
|
99
|
+
slug={project.slug}
|
|
100
|
+
creditsAvailable={project.creditsAvailable}
|
|
101
|
+
projectDeveloper={project.projectDeveloper?.name}
|
|
102
|
+
/>
|
|
103
|
+
</MinimalProviders>
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// Offset is needed to center the marker on the coordinates
|
|
107
|
+
const marker = new Marker(ref.current, { offset: [-20, -40] });
|
|
108
|
+
|
|
109
|
+
// No chaining here, because the mocks don't support it
|
|
110
|
+
marker.setLngLat(project.geom.coordinates);
|
|
111
|
+
marker.addTo(map);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Clean up on unmount
|
|
115
|
+
return () => map.remove();
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<DefaultSectionContainer>
|
|
120
|
+
<Wrapper>
|
|
121
|
+
{slice.title ? (
|
|
122
|
+
<>
|
|
123
|
+
<DefaultSectionHeader
|
|
124
|
+
tagline={slice.tagline}
|
|
125
|
+
title={slice.title}
|
|
126
|
+
text={slice.text}
|
|
127
|
+
taglineProps={{ textAlign: 'center' }}
|
|
128
|
+
titleProps={{ textAlign: 'center', maxW: '6xl', marginX: 'auto' }}
|
|
129
|
+
textProps={{ textAlign: 'center', maxW: '3xl', marginX: 'auto' }}
|
|
130
|
+
/>
|
|
131
|
+
<Box height="16" />
|
|
132
|
+
</>
|
|
133
|
+
) : (
|
|
134
|
+
<></>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
<Box
|
|
138
|
+
height="xl"
|
|
139
|
+
ref={mapContainer}
|
|
140
|
+
borderRadius="xl"
|
|
141
|
+
overflow="hidden"
|
|
142
|
+
boxShadow={['md', null, null, 'none']}
|
|
143
|
+
css={css`
|
|
144
|
+
mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
|
|
145
|
+
`}
|
|
146
|
+
/>
|
|
147
|
+
</Wrapper>
|
|
148
|
+
</DefaultSectionContainer>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { storybookStrapiCoverMock } from '@/test/storybookMocks/storybookStrapiMedia';
|
|
4
|
+
import QAndA from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'sections/QAndA',
|
|
8
|
+
component: QAndA,
|
|
9
|
+
} as Meta<typeof QAndA>;
|
|
10
|
+
|
|
11
|
+
const Template: StoryFn<typeof QAndA> = (args) => <QAndA {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Minimal = Template.bind({});
|
|
14
|
+
Minimal.args = {
|
|
15
|
+
slice: {
|
|
16
|
+
tagline: 'Tagline',
|
|
17
|
+
title: 'Title',
|
|
18
|
+
questionsAndAnswers: [
|
|
19
|
+
{ id: 1, key: 'Question 1', value: 'Answer 1' },
|
|
20
|
+
{ id: 2, key: 'Question 2', value: 'Answer 2' },
|
|
21
|
+
{ id: 3, key: 'Question 3', value: 'Answer 3' },
|
|
22
|
+
],
|
|
23
|
+
otherQuestions: 'Other questions?',
|
|
24
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const WithHero = Template.bind({});
|
|
29
|
+
WithHero.args = {
|
|
30
|
+
slice: {
|
|
31
|
+
tagline: 'Tagline',
|
|
32
|
+
title: 'Title',
|
|
33
|
+
questionsAndAnswers: [
|
|
34
|
+
{ id: 1, key: 'Question 1', value: 'Answer 1' },
|
|
35
|
+
{ id: 2, key: 'Question 2', value: 'Answer 2' },
|
|
36
|
+
{ id: 3, key: 'Question 3', value: 'Answer 3' },
|
|
37
|
+
],
|
|
38
|
+
otherQuestions: 'Other questions?',
|
|
39
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
40
|
+
hero: {
|
|
41
|
+
id: 1,
|
|
42
|
+
title: 'Title',
|
|
43
|
+
subTitle: 'Sub title',
|
|
44
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
45
|
+
image: {
|
|
46
|
+
id: 1,
|
|
47
|
+
alt: 'Hero image alt text',
|
|
48
|
+
img: { data: storybookStrapiCoverMock },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const WithScroll = Template.bind({});
|
|
55
|
+
WithScroll.args = {
|
|
56
|
+
slice: {
|
|
57
|
+
tagline: 'Tagline',
|
|
58
|
+
title: 'Title',
|
|
59
|
+
questionsAndAnswers: [
|
|
60
|
+
{ id: 1, key: 'Question 1', value: 'Answer 1' },
|
|
61
|
+
{ id: 2, key: 'Question 2', value: 'Answer 2' },
|
|
62
|
+
{ id: 3, key: 'Question 3', value: 'Answer 3' },
|
|
63
|
+
{ id: 4, key: 'Question 3', value: 'Answer 4' },
|
|
64
|
+
{ id: 5, key: 'Question 3', value: 'Answer 5' },
|
|
65
|
+
{ id: 6, key: 'Question 3', value: 'Answer 6' },
|
|
66
|
+
{ id: 7, key: 'Question 3', value: 'Answer 7' },
|
|
67
|
+
],
|
|
68
|
+
otherQuestions: 'Other questions?',
|
|
69
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const Gray = Template.bind({});
|
|
74
|
+
Gray.args = {
|
|
75
|
+
slice: {
|
|
76
|
+
variant: 'gray',
|
|
77
|
+
tagline: 'Tagline',
|
|
78
|
+
title: 'Title',
|
|
79
|
+
questionsAndAnswers: [
|
|
80
|
+
{ id: 1, key: 'Question 1', value: 'Answer 1' },
|
|
81
|
+
{ id: 2, key: 'Question 2', value: 'Answer 2' },
|
|
82
|
+
{ id: 3, key: 'Question 3', value: 'Answer 3' },
|
|
83
|
+
],
|
|
84
|
+
otherQuestions: 'Other questions?',
|
|
85
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const White = Template.bind({});
|
|
90
|
+
White.args = {
|
|
91
|
+
slice: {
|
|
92
|
+
variant: 'white',
|
|
93
|
+
tagline: 'Tagline',
|
|
94
|
+
title: 'Title',
|
|
95
|
+
questionsAndAnswers: [
|
|
96
|
+
{ id: 1, key: 'Question 1', value: 'Answer 1' },
|
|
97
|
+
{ id: 2, key: 'Question 2', value: 'Answer 2' },
|
|
98
|
+
{ id: 3, key: 'Question 3', value: 'Answer 3' },
|
|
99
|
+
],
|
|
100
|
+
otherQuestions: 'Other questions?',
|
|
101
|
+
button: { id: 1, text: 'Button', url: 'https://tree.ly' },
|
|
102
|
+
},
|
|
103
|
+
};
|