@treely/strapi-slices 2.0.0 → 2.2.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/package.json +1 -2
- package/src/components/SEOTags/SEOTags.tsx +53 -0
- package/src/components/SEOTags/index.ts +1 -0
- package/src/constants/metadata.ts +3 -0
- package/src/constants/sectionsConfig.ts +20 -0
- package/src/index.tsx +119 -0
- package/src/models/HeaderType.ts +6 -0
- package/src/models/Image.ts +6 -0
- package/src/models/PageMetadata.ts +11 -0
- package/src/models/PageProps.ts +32 -0
- package/src/models/strapi/StrapiBlogPostProps.ts +7 -0
- package/src/models/strapi/StrapiCustomerStoryProps.ts +9 -0
- package/src/models/strapi/StrapiPageProps.ts +7 -0
- package/src/models/strapi/StrapiProjectProps.ts +7 -0
- package/src/test/mocks/getStaticPropsContext.ts +9 -0
- package/src/utils/mergeGlobalAndStrapiBlogPostData.test.ts +154 -0
- package/src/utils/mergeGlobalAndStrapiBlogPostData.ts +68 -0
- package/src/utils/mergeGlobalAndStrapiCustomerStoryData.test.ts +149 -0
- package/src/utils/mergeGlobalAndStrapiCustomerStoryData.ts +68 -0
- package/src/utils/mergeGlobalAndStrapiPageData.test.ts +254 -0
- package/src/utils/mergeGlobalAndStrapiPageData.ts +81 -0
- package/src/utils/mergeGlobalAndStrapiProjectData.test.ts +243 -0
- package/src/utils/mergeGlobalAndStrapiProjectData.ts +79 -0
- package/dist/components/ContextProvider/ContextProvider.d.ts +0 -8
- package/dist/components/ContextProvider/index.d.ts +0 -1
- package/dist/components/CreditsAvailableBadge/CreditsAvailableBadge.d.ts +0 -8
- package/dist/components/CreditsAvailableBadge/index.d.ts +0 -2
- package/dist/components/CreditsAvailableBadge/messages.de.d.ts +0 -7
- package/dist/components/CreditsAvailableBadge/messages.en.d.ts +0 -7
- package/dist/components/FullScreenImage/FullScreenImage.d.ts +0 -9
- package/dist/components/FullScreenImage/ZoomableImage.d.ts +0 -8
- package/dist/components/FullScreenImage/index.d.ts +0 -2
- package/dist/components/MinimalProviders/MinimalProviders.d.ts +0 -7
- package/dist/components/MinimalProviders/index.d.ts +0 -2
- package/dist/components/SliceRenderer/SliceRenderer.d.ts +0 -19
- package/dist/components/SliceRenderer/index.d.ts +0 -1
- package/dist/components/StrapiLinkButton/StrapiLinkButton.d.ts +0 -18
- package/dist/components/StrapiLinkButton/index.d.ts +0 -2
- package/dist/components/StrapiLinkButtonWithIcon/StrapiLinkButtonWithIcon.d.ts +0 -7
- package/dist/components/StrapiLinkButtonWithIcon/index.d.ts +0 -2
- package/dist/components/portfolio/Contact/Contact.d.ts +0 -10
- package/dist/components/portfolio/Contact/index.d.ts +0 -2
- package/dist/components/portfolio/DocumentsDownloadList/DocumentsDownloadList.d.ts +0 -6
- package/dist/components/portfolio/DocumentsDownloadList/index.d.ts +0 -2
- package/dist/components/portfolio/DocumentsDownloadList/messages.de.d.ts +0 -5
- package/dist/components/portfolio/DocumentsDownloadList/messages.en.d.ts +0 -5
- package/dist/components/portfolio/ProjectInfo/ProjectInfo.d.ts +0 -18
- package/dist/components/portfolio/ProjectInfo/index.d.ts +0 -2
- package/dist/components/portfolio/ProjectInfo/messages.de.d.ts +0 -15
- package/dist/components/portfolio/ProjectInfo/messages.en.d.ts +0 -15
- package/dist/components/portfolio/SmallCheckout/SmallCheckout.d.ts +0 -14
- package/dist/components/portfolio/SmallCheckout/index.d.ts +0 -2
- package/dist/components/portfolio/SmallCheckout/messages.de.d.ts +0 -16
- package/dist/components/portfolio/SmallCheckout/messages.en.d.ts +0 -16
- package/dist/constants/animations.d.ts +0 -1
- package/dist/constants/api.d.ts +0 -3
- package/dist/constants/breakpoints.d.ts +0 -8
- package/dist/constants/domain.d.ts +0 -2
- package/dist/constants/fontCustomizations.d.ts +0 -6
- package/dist/constants/formatter.d.ts +0 -6
- package/dist/constants/globalStyle.d.ts +0 -1
- package/dist/constants/mapbox.d.ts +0 -17
- package/dist/constants/strapi.d.ts +0 -1
- package/dist/icons/LinkedInIcon.d.ts +0 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -8
- package/dist/models/BBox.d.ts +0 -2
- package/dist/models/CreditsAvailableState.d.ts +0 -7
- package/dist/models/Locale.d.ts +0 -2
- package/dist/models/PortfolioProject.d.ts +0 -7
- package/dist/models/forms/CheckoutForm.d.ts +0 -4
- package/dist/models/fpm/FPMProject.d.ts +0 -37
- package/dist/models/fpm/Issuer.d.ts +0 -6
- package/dist/models/strapi/IStrapi.d.ts +0 -4
- package/dist/models/strapi/IStrapiData.d.ts +0 -5
- package/dist/models/strapi/IStrapiResponse.d.ts +0 -13
- package/dist/models/strapi/StrapiAuthor.d.ts +0 -10
- package/dist/models/strapi/StrapiAvatarWithName.d.ts +0 -8
- package/dist/models/strapi/StrapiBanner.d.ts +0 -9
- package/dist/models/strapi/StrapiBlogPost.d.ts +0 -25
- package/dist/models/strapi/StrapiButtonWithVariant.d.ts +0 -6
- package/dist/models/strapi/StrapiCategory.d.ts +0 -8
- package/dist/models/strapi/StrapiContactArea.d.ts +0 -10
- package/dist/models/strapi/StrapiCustomerStory.d.ts +0 -21
- package/dist/models/strapi/StrapiDefaultHeader.d.ts +0 -6
- package/dist/models/strapi/StrapiGlobal.d.ts +0 -26
- package/dist/models/strapi/StrapiGlossaryItem.d.ts +0 -6
- package/dist/models/strapi/StrapiHeroCard.d.ts +0 -13
- package/dist/models/strapi/StrapiImage.d.ts +0 -10
- package/dist/models/strapi/StrapiImageFormat.d.ts +0 -12
- package/dist/models/strapi/StrapiImageWithLink.d.ts +0 -6
- package/dist/models/strapi/StrapiLink.d.ts +0 -11
- package/dist/models/strapi/StrapiLinkList.d.ts +0 -7
- package/dist/models/strapi/StrapiLinkPage.d.ts +0 -10
- package/dist/models/strapi/StrapiLinkWithIcon.d.ts +0 -7
- package/dist/models/strapi/StrapiLocalization.d.ts +0 -7
- package/dist/models/strapi/StrapiMedia.d.ts +0 -27
- package/dist/models/strapi/StrapiMetadata.d.ts +0 -13
- package/dist/models/strapi/StrapiNavMenu.d.ts +0 -13
- package/dist/models/strapi/StrapiPage.d.ts +0 -17
- package/dist/models/strapi/StrapiPortfolio.d.ts +0 -10
- package/dist/models/strapi/StrapiPortfolioCard.d.ts +0 -15
- package/dist/models/strapi/StrapiProject.d.ts +0 -23
- package/dist/models/strapi/StrapiProjectCard.d.ts +0 -18
- package/dist/models/strapi/StrapiQuoteCard.d.ts +0 -7
- package/dist/models/strapi/StrapiShapesCard.d.ts +0 -11
- package/dist/models/strapi/StrapiTextCardWithIcons.d.ts +0 -8
- package/dist/models/strapi/StrapiTopBanner.d.ts +0 -7
- package/dist/rootMessages.de.d.ts +0 -58
- package/dist/rootMessages.en.d.ts +0 -58
- package/dist/slices/Blog/Blog.d.ts +0 -10
- package/dist/slices/Blog/index.d.ts +0 -2
- package/dist/slices/Blog/styles.d.ts +0 -7
- package/dist/slices/BlogCards/BlogCards.d.ts +0 -18
- package/dist/slices/BlogCards/index.d.ts +0 -2
- package/dist/slices/Comparison/Comparison.d.ts +0 -33
- package/dist/slices/Comparison/Icon.d.ts +0 -7
- package/dist/slices/Comparison/index.d.ts +0 -2
- package/dist/slices/Comparison/messages.de.d.ts +0 -4
- package/dist/slices/Comparison/messages.en.d.ts +0 -4
- package/dist/slices/Cta/Cta.d.ts +0 -26
- package/dist/slices/Cta/index.d.ts +0 -2
- package/dist/slices/Cta/messages.de.d.ts +0 -5
- package/dist/slices/Cta/messages.en.d.ts +0 -5
- package/dist/slices/CtaOnly/CtaOnly.d.ts +0 -8
- package/dist/slices/CtaOnly/index.d.ts +0 -2
- package/dist/slices/CustomerStories/CustomerStories.d.ts +0 -10
- package/dist/slices/CustomerStories/index.d.ts +0 -2
- package/dist/slices/CustomerStories/messages.de.d.ts +0 -4
- package/dist/slices/CustomerStories/messages.en.d.ts +0 -4
- package/dist/slices/Facts/Facts.d.ts +0 -16
- package/dist/slices/Facts/index.d.ts +0 -2
- package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.d.ts +0 -10
- package/dist/slices/FullWidthHighlightQuote/index.d.ts +0 -2
- package/dist/slices/FullWidthImage/FullWidthImage.d.ts +0 -11
- package/dist/slices/FullWidthImage/index.d.ts +0 -2
- package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.d.ts +0 -12
- package/dist/slices/FullWidthImageSlider/index.d.ts +0 -2
- package/dist/slices/FullWidthImageSlider/styles.d.ts +0 -290
- package/dist/slices/FullWidthImageSlider/utils.d.ts +0 -1
- package/dist/slices/FullWidthImageSlider/utils.test.d.ts +0 -1
- package/dist/slices/Glossary/Glossary.d.ts +0 -9
- package/dist/slices/Glossary/index.d.ts +0 -2
- package/dist/slices/Glossary/messages.de.d.ts +0 -6
- package/dist/slices/Glossary/messages.en.d.ts +0 -6
- package/dist/slices/Hero/Hero.d.ts +0 -17
- package/dist/slices/Hero/index.d.ts +0 -2
- package/dist/slices/IconGrid/IconGrid.d.ts +0 -18
- package/dist/slices/IconGrid/index.d.ts +0 -2
- package/dist/slices/ImageGrid/ImageGrid.d.ts +0 -18
- package/dist/slices/ImageGrid/index.d.ts +0 -2
- package/dist/slices/ImageTextSequence/ImageTextSequence.d.ts +0 -19
- package/dist/slices/ImageTextSequence/index.d.ts +0 -2
- package/dist/slices/LeftTextRightCard/LeftTextRightCard.d.ts +0 -17
- package/dist/slices/LeftTextRightCard/index.d.ts +0 -2
- package/dist/slices/LinkCardsGrid/LinkCardsGrid.d.ts +0 -18
- package/dist/slices/LinkCardsGrid/index.d.ts +0 -2
- package/dist/slices/LogoGridWithText/LogoGridWithText.d.ts +0 -12
- package/dist/slices/LogoGridWithText/index.d.ts +0 -2
- package/dist/slices/MapHero/MapHero.d.ts +0 -15
- package/dist/slices/MapHero/index.d.ts +0 -2
- package/dist/slices/MapHero/styles.d.ts +0 -16
- package/dist/slices/ProjectFacts/ProjectFacts.d.ts +0 -34
- package/dist/slices/ProjectFacts/index.d.ts +0 -2
- package/dist/slices/ProjectFacts/messages.de.d.ts +0 -5
- package/dist/slices/ProjectFacts/messages.en.d.ts +0 -5
- package/dist/slices/ProjectsGrid/ProjectsGrid.d.ts +0 -8
- package/dist/slices/ProjectsGrid/index.d.ts +0 -2
- package/dist/slices/ProjectsMap/MapMarker.d.ts +0 -11
- package/dist/slices/ProjectsMap/ProjectsMap.d.ts +0 -16
- package/dist/slices/ProjectsMap/index.d.ts +0 -2
- package/dist/slices/ProjectsMap/mapboxStyle.d.ts +0 -2
- package/dist/slices/ProjectsMap/messages.de.d.ts +0 -4
- package/dist/slices/ProjectsMap/messages.en.d.ts +0 -4
- package/dist/slices/QAndA/QAndA.d.ts +0 -43
- package/dist/slices/QAndA/index.d.ts +0 -2
- package/dist/slices/QuoteCards/QuoteCards.d.ts +0 -15
- package/dist/slices/QuoteCards/index.d.ts +0 -2
- package/dist/slices/RichTextSection/RichTextSection.d.ts +0 -7
- package/dist/slices/RichTextSection/index.d.ts +0 -2
- package/dist/slices/ShopCheckout/ShopCheckout.d.ts +0 -16
- package/dist/slices/ShopCheckout/index.d.ts +0 -2
- package/dist/slices/ShopCheckout/messages.de.d.ts +0 -15
- package/dist/slices/ShopCheckout/messages.en.d.ts +0 -15
- package/dist/slices/SideBySideImages/SideBySideImages.d.ts +0 -12
- package/dist/slices/SideBySideImages/index.d.ts +0 -2
- package/dist/slices/SmallHero/SmallHero.d.ts +0 -20
- package/dist/slices/SmallHero/index.d.ts +0 -2
- package/dist/slices/Steps/Steps.d.ts +0 -19
- package/dist/slices/Steps/index.d.ts +0 -2
- package/dist/slices/TextCardGrid/TextCardGrid.d.ts +0 -20
- package/dist/slices/TextCardGrid/index.d.ts +0 -2
- package/dist/slices/TextCarousel/TextCarousel.d.ts +0 -13
- package/dist/slices/TextCarousel/index.d.ts +0 -2
- package/dist/slices/TextCarousel/styles.d.ts +0 -281
- package/dist/slices/TextWithCard/TextWithCard.d.ts +0 -20
- package/dist/slices/TextWithCard/index.d.ts +0 -2
- package/dist/slices/TextWithTextCards/TextWithTextCards.d.ts +0 -15
- package/dist/slices/TextWithTextCards/index.d.ts +0 -2
- package/dist/slices/Video/Video.d.ts +0 -10
- package/dist/slices/Video/index.d.ts +0 -2
- package/dist/strapi-slices.cjs.development.js +0 -4653
- package/dist/strapi-slices.cjs.development.js.map +0 -1
- package/dist/strapi-slices.cjs.production.min.js +0 -2
- package/dist/strapi-slices.cjs.production.min.js.map +0 -1
- package/dist/strapi-slices.esm.js +0 -4640
- package/dist/strapi-slices.esm.js.map +0 -1
- package/dist/test/defaultMocks/next.d.ts +0 -2
- package/dist/test/integrationMocks/fpmProjectMock.d.ts +0 -3
- package/dist/test/mocks/portfolioProjectMock.d.ts +0 -3
- package/dist/test/setupTests.d.ts +0 -1
- package/dist/test/storybookMocks/storybookMedia.d.ts +0 -1
- package/dist/test/storybookMocks/storybookStrapiMedia.d.ts +0 -8
- package/dist/test/strapiMocks/minimalGlobalData.d.ts +0 -4
- package/dist/test/strapiMocks/strapiAvatarWithName.d.ts +0 -12
- package/dist/test/strapiMocks/strapiBlogPost.d.ts +0 -3
- package/dist/test/strapiMocks/strapiContact.d.ts +0 -2
- package/dist/test/strapiMocks/strapiCustomerStory.d.ts +0 -3
- package/dist/test/strapiMocks/strapiHeroCard.d.ts +0 -2
- package/dist/test/strapiMocks/strapiLinkPage.d.ts +0 -3
- package/dist/test/strapiMocks/strapiMedia.d.ts +0 -3
- package/dist/test/strapiMocks/strapiMetadata.d.ts +0 -2
- package/dist/test/strapiMocks/strapiPage.d.ts +0 -3
- package/dist/test/strapiMocks/strapiPortfolioCard.d.ts +0 -2
- package/dist/test/strapiMocks/strapiPortfolioMock.d.ts +0 -3
- package/dist/test/strapiMocks/strapiProject.d.ts +0 -3
- package/dist/test/strapiMocks/strapiProjectCard.d.ts +0 -2
- package/dist/test/strapiMocks/strapiQuoteCard.d.ts +0 -2
- package/dist/test/testUtils.d.ts +0 -6
- package/dist/unit.messages.de.d.ts +0 -5
- package/dist/unit.messages.en.d.ts +0 -5
- package/dist/utils/convertAreaM2ToHa.d.ts +0 -2
- package/dist/utils/convertAreaM2ToHa.test.d.ts +0 -1
- package/dist/utils/convertCo2AmountKgToTons.d.ts +0 -2
- package/dist/utils/convertToKebabCase.d.ts +0 -2
- package/dist/utils/convertToKebabCase.test.d.ts +0 -1
- package/dist/utils/getTimeSpanInYears.d.ts +0 -2
- package/dist/utils/getTimeSpanInYears.test.d.ts +0 -1
- package/dist/utils/mergeBoundingBoxes.d.ts +0 -3
- package/dist/utils/mergeBoundingBoxes.test.d.ts +0 -1
- package/dist/utils/mergeDeep.d.ts +0 -12
- package/dist/utils/openHubSpotChat.d.ts +0 -2
- package/dist/utils/strapiLinkUrl.d.ts +0 -3
- package/dist/utils/strapiLinkUrl.test.d.ts +0 -1
- package/dist/utils/strapiMediaUrl.d.ts +0 -5
- package/dist/utils/strapiMediaUrl.test.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treely/strapi-slices",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Tree.ly GmbH",
|
|
6
6
|
"description": "@treely/strapi-slices is a open source library maintained by Tree.ly.",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"analyze": "size-limit --why",
|
|
32
32
|
"build": "dts build",
|
|
33
33
|
"lint": "dts lint",
|
|
34
|
-
"prepare": "dts build",
|
|
35
34
|
"size": "size-limit",
|
|
36
35
|
"start": "dts watch",
|
|
37
36
|
"test": "dts test --passWithNoTests",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Head from 'next/head';
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_SHARE_ALT,
|
|
5
|
+
DEFAULT_SHARE_IMAGE,
|
|
6
|
+
} from '../../constants/metadata';
|
|
7
|
+
|
|
8
|
+
interface SEOTagsProps {
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
shareImage?: {
|
|
12
|
+
url: string;
|
|
13
|
+
alt: string;
|
|
14
|
+
};
|
|
15
|
+
metaTitleSuffix?: string;
|
|
16
|
+
favicon?: string;
|
|
17
|
+
domain?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const SEOTags: React.FC<SEOTagsProps> = ({
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
shareImage,
|
|
24
|
+
metaTitleSuffix = 'Tree.ly',
|
|
25
|
+
favicon = 'https://cdn.tree.ly/favicon.ico',
|
|
26
|
+
domain = 'tree.ly',
|
|
27
|
+
}: SEOTagsProps) => {
|
|
28
|
+
const shareImageUrl = shareImage?.url ?? DEFAULT_SHARE_IMAGE;
|
|
29
|
+
const shareImageAlt = shareImage?.alt ?? DEFAULT_SHARE_ALT;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Head>
|
|
33
|
+
<title>{`${title} - ${metaTitleSuffix}`}</title>
|
|
34
|
+
<meta name="description" content={description} />
|
|
35
|
+
<link rel="icon" href={favicon} />
|
|
36
|
+
|
|
37
|
+
<meta property="og:url" content={`https://${domain}`} />
|
|
38
|
+
<meta property="og:type" content="website" />
|
|
39
|
+
<meta property="og:title" content={title} />
|
|
40
|
+
<meta property="og:description" content={description} />
|
|
41
|
+
<meta property="og:image" content={shareImageUrl} />
|
|
42
|
+
<meta property="og:image:alt" content={shareImageAlt} />
|
|
43
|
+
|
|
44
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
45
|
+
<meta property="twitter:domain" content={domain} />
|
|
46
|
+
<meta property="twitter:url" content={`https://${domain}`} />
|
|
47
|
+
<meta name="twitter:title" content={title} />
|
|
48
|
+
<meta name="twitter:description" content={description} />
|
|
49
|
+
<meta name="twitter:image" content={shareImageUrl} />
|
|
50
|
+
<meta name="twitter:image:alt" content={shareImageAlt} />
|
|
51
|
+
</Head>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SEOTags } from './SEOTags';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const EXTENDABLE_HEADER_SECTIONS = [
|
|
2
|
+
'sections.hero',
|
|
3
|
+
'sections.map-hero',
|
|
4
|
+
'sections.full-width-image',
|
|
5
|
+
'sections.small-hero',
|
|
6
|
+
'sections.small-hero-light',
|
|
7
|
+
];
|
|
8
|
+
export const DARK_THEME_HEADER_SECTIONS = [
|
|
9
|
+
'sections.hero',
|
|
10
|
+
'sections.small-hero',
|
|
11
|
+
];
|
|
12
|
+
export const SECTIONS_WITH_BLOG_POSTS = [
|
|
13
|
+
'sections.blog',
|
|
14
|
+
'sections.blog-cards',
|
|
15
|
+
];
|
|
16
|
+
export const SECTIONS_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
|
|
17
|
+
export const SECTIONS_WITH_PROJECTS = [
|
|
18
|
+
'sections.projects-map',
|
|
19
|
+
'sections.project-facts',
|
|
20
|
+
];
|
package/src/index.tsx
CHANGED
|
@@ -1 +1,120 @@
|
|
|
1
|
+
import IStrapi from './models/strapi/IStrapi';
|
|
2
|
+
import IStrapiData from './models/strapi/IStrapiData';
|
|
3
|
+
import IStrapiResponse from './models/strapi/IStrapiResponse';
|
|
4
|
+
import StrapiAuthor from './models/strapi/StrapiAuthor';
|
|
5
|
+
import StrapiAvatarWithName from './models/strapi/StrapiAvatarWithName';
|
|
6
|
+
import StrapiBanner from './models/strapi/StrapiBanner';
|
|
7
|
+
import StrapiBlogPost from './models/strapi/StrapiBlogPost';
|
|
8
|
+
import StrapiBlogPostProps from './models/strapi/StrapiBlogPostProps';
|
|
9
|
+
import StrapiButtonWithVariant from './models/strapi/StrapiButtonWithVariant';
|
|
10
|
+
import StrapiCategory from './models/strapi/StrapiCategory';
|
|
11
|
+
import StrapiContactArea from './models/strapi/StrapiContactArea';
|
|
12
|
+
import StrapiCustomerStory from './models/strapi/StrapiCustomerStory';
|
|
13
|
+
import StrapiCustomerStoryProps from './models/strapi/StrapiCustomerStoryProps';
|
|
14
|
+
import StrapiDefaultHeader from './models/strapi/StrapiDefaultHeader';
|
|
15
|
+
import StrapiGlobal from './models/strapi/StrapiGlobal';
|
|
16
|
+
import StrapiGlossaryItem from './models/strapi/StrapiGlossaryItem';
|
|
17
|
+
import StrapiHeroCard from './models/strapi/StrapiHeroCard';
|
|
18
|
+
import StrapiImage from './models/strapi/StrapiImage';
|
|
19
|
+
import StrapiImageFormat from './models/strapi/StrapiImageFormat';
|
|
20
|
+
import StrapiImageWithLink from './models/strapi/StrapiImageWithLink';
|
|
21
|
+
import StrapiLink from './models/strapi/StrapiLink';
|
|
22
|
+
import StrapiLinkList from './models/strapi/StrapiLinkList';
|
|
23
|
+
import StrapiLinkPage from './models/strapi/StrapiLinkPage';
|
|
24
|
+
import StrapiLinkWithIcon from './models/strapi/StrapiLinkWithIcon';
|
|
25
|
+
import StrapiLocalization from './models/strapi/StrapiLocalization';
|
|
26
|
+
import StrapiMedia from './models/strapi/StrapiMedia';
|
|
27
|
+
import StrapiMetadata from './models/strapi/StrapiMetadata';
|
|
28
|
+
import StrapiNavMenu from './models/strapi/StrapiNavMenu';
|
|
29
|
+
import StrapiPage from './models/strapi/StrapiPage';
|
|
30
|
+
import StrapiPageProps from './models/strapi/StrapiPageProps';
|
|
31
|
+
import StrapiPortfolio from './models/strapi/StrapiPortfolio';
|
|
32
|
+
import StrapiPortfolioCard from './models/strapi/StrapiPortfolioCard';
|
|
33
|
+
import StrapiProject from './models/strapi/StrapiProject';
|
|
34
|
+
import StrapiProjectProps from './models/strapi/StrapiProjectProps';
|
|
35
|
+
import StrapiProjectCard from './models/strapi/StrapiProjectCard';
|
|
36
|
+
import StrapiQuoteCard from './models/strapi/StrapiQuoteCard';
|
|
37
|
+
import StrapiShapesCard from './models/strapi/StrapiShapesCard';
|
|
38
|
+
import StrapiTextCardWithIcons from './models/strapi/StrapiTextCardWithIcons';
|
|
39
|
+
import StrapiTopBanner from './models/strapi/StrapiTopBanner';
|
|
40
|
+
|
|
41
|
+
import HeaderType from './models/HeaderType';
|
|
42
|
+
import Image from './models/Image';
|
|
43
|
+
import PageMetadata from './models/PageMetadata';
|
|
44
|
+
import PageProps from './models/PageProps';
|
|
45
|
+
|
|
46
|
+
import mergeGlobalAndStrapiBlogPostData from './utils/mergeGlobalAndStrapiBlogPostData';
|
|
47
|
+
import mergeGlobalAndStrapiCustomerStoryData from './utils/mergeGlobalAndStrapiCustomerStoryData';
|
|
48
|
+
import mergeGlobalAndStrapiPageData from './utils/mergeGlobalAndStrapiPageData';
|
|
49
|
+
import mergeGlobalAndStrapiProjectData from './utils/mergeGlobalAndStrapiProjectData';
|
|
50
|
+
|
|
51
|
+
import {
|
|
52
|
+
SECTIONS_WITH_BLOG_POSTS,
|
|
53
|
+
SECTIONS_WITH_CUSTOMER_STORIES,
|
|
54
|
+
SECTIONS_WITH_PROJECTS,
|
|
55
|
+
} from './constants/sectionsConfig';
|
|
56
|
+
|
|
57
|
+
export * from './components/SEOTags';
|
|
1
58
|
export * from './components/SliceRenderer';
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
// Utils
|
|
62
|
+
mergeGlobalAndStrapiBlogPostData,
|
|
63
|
+
mergeGlobalAndStrapiCustomerStoryData,
|
|
64
|
+
mergeGlobalAndStrapiPageData,
|
|
65
|
+
mergeGlobalAndStrapiProjectData,
|
|
66
|
+
|
|
67
|
+
// Constants
|
|
68
|
+
SECTIONS_WITH_BLOG_POSTS,
|
|
69
|
+
SECTIONS_WITH_CUSTOMER_STORIES,
|
|
70
|
+
SECTIONS_WITH_PROJECTS,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type {
|
|
74
|
+
// Strapi Models
|
|
75
|
+
IStrapi,
|
|
76
|
+
IStrapiData,
|
|
77
|
+
IStrapiResponse,
|
|
78
|
+
StrapiAuthor,
|
|
79
|
+
StrapiAvatarWithName,
|
|
80
|
+
StrapiBanner,
|
|
81
|
+
StrapiBlogPost,
|
|
82
|
+
StrapiBlogPostProps,
|
|
83
|
+
StrapiButtonWithVariant,
|
|
84
|
+
StrapiCategory,
|
|
85
|
+
StrapiContactArea,
|
|
86
|
+
StrapiCustomerStory,
|
|
87
|
+
StrapiCustomerStoryProps,
|
|
88
|
+
StrapiDefaultHeader,
|
|
89
|
+
StrapiGlobal,
|
|
90
|
+
StrapiGlossaryItem,
|
|
91
|
+
StrapiHeroCard,
|
|
92
|
+
StrapiImage,
|
|
93
|
+
StrapiImageFormat,
|
|
94
|
+
StrapiImageWithLink,
|
|
95
|
+
StrapiLink,
|
|
96
|
+
StrapiLinkList,
|
|
97
|
+
StrapiLinkPage,
|
|
98
|
+
StrapiLinkWithIcon,
|
|
99
|
+
StrapiLocalization,
|
|
100
|
+
StrapiMedia,
|
|
101
|
+
StrapiMetadata,
|
|
102
|
+
StrapiNavMenu,
|
|
103
|
+
StrapiPage,
|
|
104
|
+
StrapiPageProps,
|
|
105
|
+
StrapiPortfolio,
|
|
106
|
+
StrapiPortfolioCard,
|
|
107
|
+
StrapiProject,
|
|
108
|
+
StrapiProjectProps,
|
|
109
|
+
StrapiProjectCard,
|
|
110
|
+
StrapiQuoteCard,
|
|
111
|
+
StrapiShapesCard,
|
|
112
|
+
StrapiTextCardWithIcons,
|
|
113
|
+
StrapiTopBanner,
|
|
114
|
+
|
|
115
|
+
// Models
|
|
116
|
+
HeaderType,
|
|
117
|
+
Image,
|
|
118
|
+
PageMetadata,
|
|
119
|
+
PageProps,
|
|
120
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IStrapiData,
|
|
3
|
+
StrapiBanner,
|
|
4
|
+
StrapiBlogPost,
|
|
5
|
+
StrapiCustomerStory,
|
|
6
|
+
StrapiLink,
|
|
7
|
+
StrapiLinkList,
|
|
8
|
+
StrapiNavMenu,
|
|
9
|
+
StrapiTopBanner,
|
|
10
|
+
} from '..';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
12
|
+
import PortfolioProject from './PortfolioProject';
|
|
13
|
+
import PageMetadata from './PageMetadata';
|
|
14
|
+
import HeaderType from './HeaderType';
|
|
15
|
+
|
|
16
|
+
interface PageProps {
|
|
17
|
+
headerType?: HeaderType;
|
|
18
|
+
headerNavMenus?: StrapiNavMenu[];
|
|
19
|
+
headerButtons?: StrapiLink[];
|
|
20
|
+
footerLinks?: StrapiLinkList[];
|
|
21
|
+
hideFooter?: boolean;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
metadata: PageMetadata;
|
|
24
|
+
slices: any[];
|
|
25
|
+
blogPosts: IStrapiData<StrapiBlogPost>[];
|
|
26
|
+
projects: PortfolioProject[];
|
|
27
|
+
banner?: StrapiBanner;
|
|
28
|
+
topBanner?: StrapiTopBanner;
|
|
29
|
+
customerStories: IStrapiData<StrapiCustomerStory>[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default PageProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import PageProps from '../PageProps';
|
|
2
|
+
import IStrapiData from './IStrapiData';
|
|
3
|
+
import StrapiCustomerStory from './StrapiCustomerStory';
|
|
4
|
+
|
|
5
|
+
interface StrapiCustomerStoryProps
|
|
6
|
+
extends PageProps,
|
|
7
|
+
IStrapiData<StrapiCustomerStory> {}
|
|
8
|
+
|
|
9
|
+
export default StrapiCustomerStoryProps;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import mergeGlobalAndStrapiBlogPostData from './mergeGlobalAndStrapiBlogPostData';
|
|
2
|
+
import { strapiBlogPostMock } from '../test/strapiMocks/strapiBlogPost';
|
|
3
|
+
import minimalGlobalData from '../test/strapiMocks/minimalGlobalData';
|
|
4
|
+
import getStaticPropsContextMock from '../test/mocks/getStaticPropsContext';
|
|
5
|
+
import { strapiMetadataMock } from '../test/strapiMocks/strapiMetadata';
|
|
6
|
+
|
|
7
|
+
describe('The mergeGlobalAndStrapiBlogPostData util', () => {
|
|
8
|
+
it('returns the global metadata if there is no page metadata', () => {
|
|
9
|
+
const pageDataWithoutMetadata = {
|
|
10
|
+
...strapiBlogPostMock,
|
|
11
|
+
attributes: {
|
|
12
|
+
...strapiBlogPostMock.attributes,
|
|
13
|
+
metadata: null,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const result = mergeGlobalAndStrapiBlogPostData(
|
|
18
|
+
getStaticPropsContextMock,
|
|
19
|
+
minimalGlobalData,
|
|
20
|
+
pageDataWithoutMetadata,
|
|
21
|
+
[],
|
|
22
|
+
[]
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(result.attributes.metadata).toBe(
|
|
26
|
+
minimalGlobalData.attributes.metadata
|
|
27
|
+
);
|
|
28
|
+
expect(result.metadata.title).toBe(
|
|
29
|
+
minimalGlobalData.attributes.metadata.title
|
|
30
|
+
);
|
|
31
|
+
expect(result.metadata.description).toBe(
|
|
32
|
+
minimalGlobalData.attributes.metadata.description
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('returns the pages metadata if the page data includes metadata', () => {
|
|
37
|
+
const pageDataWithMetadata = {
|
|
38
|
+
...strapiBlogPostMock,
|
|
39
|
+
data: {
|
|
40
|
+
...strapiBlogPostMock,
|
|
41
|
+
attributes: {
|
|
42
|
+
...strapiBlogPostMock.attributes,
|
|
43
|
+
metadata: strapiMetadataMock,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const result = mergeGlobalAndStrapiBlogPostData(
|
|
49
|
+
getStaticPropsContextMock,
|
|
50
|
+
minimalGlobalData,
|
|
51
|
+
pageDataWithMetadata,
|
|
52
|
+
[],
|
|
53
|
+
[]
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
expect(result.attributes.metadata?.title).toBe(strapiMetadataMock.title);
|
|
57
|
+
expect(result.metadata?.title).toBe(strapiMetadataMock.title);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('returns the navbar links if there are links in the global data', () => {
|
|
61
|
+
const result = mergeGlobalAndStrapiBlogPostData(
|
|
62
|
+
getStaticPropsContextMock,
|
|
63
|
+
{
|
|
64
|
+
...minimalGlobalData,
|
|
65
|
+
attributes: {
|
|
66
|
+
...minimalGlobalData.attributes,
|
|
67
|
+
navbar: {
|
|
68
|
+
...minimalGlobalData.attributes.navbar,
|
|
69
|
+
navMenus: [
|
|
70
|
+
{
|
|
71
|
+
link: {
|
|
72
|
+
id: Infinity,
|
|
73
|
+
text: 'Text',
|
|
74
|
+
url: '/',
|
|
75
|
+
},
|
|
76
|
+
title: 'Title',
|
|
77
|
+
items: [],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
strapiBlogPostMock,
|
|
84
|
+
[],
|
|
85
|
+
[]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
expect(result.headerNavMenus).toStrictEqual([
|
|
89
|
+
{
|
|
90
|
+
title: 'Title',
|
|
91
|
+
items: [],
|
|
92
|
+
link: { id: Infinity, text: 'Text', url: '/' },
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('returns the navbar buttons if there are buttons in the global data', () => {
|
|
98
|
+
const result = mergeGlobalAndStrapiBlogPostData(
|
|
99
|
+
getStaticPropsContextMock,
|
|
100
|
+
{
|
|
101
|
+
...minimalGlobalData,
|
|
102
|
+
attributes: {
|
|
103
|
+
...minimalGlobalData.attributes,
|
|
104
|
+
navbar: {
|
|
105
|
+
...minimalGlobalData.attributes.navbar,
|
|
106
|
+
buttons: [
|
|
107
|
+
{
|
|
108
|
+
id: Infinity,
|
|
109
|
+
text: 'Header button',
|
|
110
|
+
url: '/',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
strapiBlogPostMock,
|
|
117
|
+
[],
|
|
118
|
+
[]
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
expect(result.headerButtons).toStrictEqual([
|
|
122
|
+
{ id: Infinity, text: 'Header button', url: '/' },
|
|
123
|
+
]);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('returns the footer links if there are links in the global data', () => {
|
|
127
|
+
const result = mergeGlobalAndStrapiBlogPostData(
|
|
128
|
+
getStaticPropsContextMock,
|
|
129
|
+
{
|
|
130
|
+
...minimalGlobalData,
|
|
131
|
+
attributes: {
|
|
132
|
+
...minimalGlobalData.attributes,
|
|
133
|
+
footer: {
|
|
134
|
+
...minimalGlobalData.attributes.footer,
|
|
135
|
+
links: [
|
|
136
|
+
{
|
|
137
|
+
id: Infinity,
|
|
138
|
+
title: 'Title',
|
|
139
|
+
links: [],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
strapiBlogPostMock,
|
|
146
|
+
[],
|
|
147
|
+
[]
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(result.footerLinks).toStrictEqual([
|
|
151
|
+
{ id: Infinity, title: 'Title', links: [] },
|
|
152
|
+
]);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GetStaticPropsContext } from 'next';
|
|
2
|
+
import strapiMediaUrl from './strapiMediaUrl';
|
|
3
|
+
import {
|
|
4
|
+
IStrapiData,
|
|
5
|
+
StrapiBlogPost,
|
|
6
|
+
StrapiBlogPostProps,
|
|
7
|
+
StrapiGlobal,
|
|
8
|
+
} from '..';
|
|
9
|
+
import PortfolioProject from '../models/PortfolioProject';
|
|
10
|
+
import { DEFAULT_SHARE_ALT, DEFAULT_SHARE_IMAGE } from '../constants/metadata';
|
|
11
|
+
|
|
12
|
+
const mergeGlobalAndStrapiBlogPostData = (
|
|
13
|
+
context: GetStaticPropsContext,
|
|
14
|
+
global: IStrapiData<StrapiGlobal>,
|
|
15
|
+
post: IStrapiData<StrapiBlogPost>,
|
|
16
|
+
blog: IStrapiData<StrapiBlogPost>[],
|
|
17
|
+
projects: PortfolioProject[]
|
|
18
|
+
): StrapiBlogPostProps => {
|
|
19
|
+
const metaShareImageUrl = post.attributes.metadata?.shareImage
|
|
20
|
+
? strapiMediaUrl(
|
|
21
|
+
post.attributes.metadata?.shareImage.media ??
|
|
22
|
+
global.attributes.metadata.shareImage?.media,
|
|
23
|
+
'large'
|
|
24
|
+
)
|
|
25
|
+
: DEFAULT_SHARE_IMAGE;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
...post,
|
|
29
|
+
// Portfolio Projects
|
|
30
|
+
projects,
|
|
31
|
+
// StrapiBlogPost
|
|
32
|
+
attributes: {
|
|
33
|
+
...post?.attributes,
|
|
34
|
+
metadata: post?.attributes?.metadata || global.attributes.metadata,
|
|
35
|
+
},
|
|
36
|
+
// PageProps
|
|
37
|
+
headerType: {
|
|
38
|
+
extendable: true,
|
|
39
|
+
theme: 'light',
|
|
40
|
+
},
|
|
41
|
+
headerNavMenus: global.attributes.navbar.navMenus || [],
|
|
42
|
+
headerButtons: global.attributes.navbar.buttons || [],
|
|
43
|
+
footerLinks: global.attributes.footer.links || [],
|
|
44
|
+
metadata: {
|
|
45
|
+
title:
|
|
46
|
+
post.attributes.metadata?.title ?? global.attributes.metadata.title,
|
|
47
|
+
description:
|
|
48
|
+
post.attributes.metadata?.description ??
|
|
49
|
+
global.attributes.metadata.description,
|
|
50
|
+
shareImage: {
|
|
51
|
+
url: metaShareImageUrl,
|
|
52
|
+
alt:
|
|
53
|
+
post.attributes.metadata?.shareImage?.alt ??
|
|
54
|
+
global.attributes.metadata.shareImage?.alt ??
|
|
55
|
+
DEFAULT_SHARE_ALT,
|
|
56
|
+
},
|
|
57
|
+
metaTitleSuffix: global.attributes.metaTitleSuffix,
|
|
58
|
+
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail'),
|
|
59
|
+
},
|
|
60
|
+
slices: post?.attributes.slices,
|
|
61
|
+
blogPosts: blog,
|
|
62
|
+
banner: global.attributes.banner,
|
|
63
|
+
topBanner: post?.attributes.topBanner || global.attributes.topBanner,
|
|
64
|
+
customerStories: [],
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default mergeGlobalAndStrapiBlogPostData;
|