@treely/strapi-slices 2.4.0 → 3.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/README.md +79 -0
- package/dist/components/CreditsAvailableBadge/messages.de.d.ts +2 -2
- package/dist/components/CreditsAvailableBadge/messages.en.d.ts +2 -2
- package/dist/components/portfolio/DocumentsDownloadList/messages.de.d.ts +2 -2
- package/dist/components/portfolio/DocumentsDownloadList/messages.en.d.ts +2 -2
- package/dist/components/portfolio/PortfolioProjectCard/PortfolioProjectCard.d.ts +6 -0
- package/dist/components/portfolio/PortfolioProjectCard/index.d.ts +2 -0
- package/dist/components/portfolio/PortfolioProjectCard/messages.de.d.ts +7 -0
- package/dist/components/portfolio/PortfolioProjectCard/messages.en.d.ts +7 -0
- package/dist/components/portfolio/ProjectInfo/messages.de.d.ts +2 -2
- package/dist/components/portfolio/ProjectInfo/messages.en.d.ts +2 -2
- package/dist/components/portfolio/SmallCheckout/messages.de.d.ts +2 -2
- package/dist/components/portfolio/SmallCheckout/messages.en.d.ts +2 -2
- package/dist/models/PortfolioProject.d.ts +3 -0
- package/dist/models/strapi/StrapiProject.d.ts +5 -3
- package/dist/models/strapi/StrapiProjectCard.d.ts +2 -12
- package/dist/rootMessages.de.d.ts +4 -0
- package/dist/rootMessages.en.d.ts +4 -0
- package/dist/slices/Comparison/messages.de.d.ts +2 -2
- package/dist/slices/Comparison/messages.en.d.ts +2 -2
- package/dist/slices/Cta/messages.de.d.ts +2 -2
- package/dist/slices/Cta/messages.en.d.ts +2 -2
- package/dist/slices/CustomerStories/messages.de.d.ts +2 -2
- package/dist/slices/CustomerStories/messages.en.d.ts +2 -2
- package/dist/slices/FullWidthImageSlider/styles.d.ts +1 -1
- package/dist/slices/Glossary/messages.de.d.ts +2 -2
- package/dist/slices/Glossary/messages.en.d.ts +2 -2
- package/dist/slices/ProjectFacts/messages.de.d.ts +2 -2
- package/dist/slices/ProjectFacts/messages.en.d.ts +2 -2
- package/dist/slices/ProjectsGrid/ProjectsGrid.d.ts +2 -4
- package/dist/slices/ProjectsMap/messages.de.d.ts +2 -2
- package/dist/slices/ProjectsMap/messages.en.d.ts +2 -2
- package/dist/slices/ShopCheckout/messages.de.d.ts +2 -2
- package/dist/slices/ShopCheckout/messages.en.d.ts +2 -2
- package/dist/slices/TextCarousel/styles.d.ts +2 -2
- package/dist/slices/TextWithCard/TextWithCard.d.ts +2 -0
- package/dist/strapi-slices.cjs.development.js +312 -276
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +313 -277
- package/dist/strapi-slices.esm.js.map +1 -1
- package/dist/test/integrationMocks/portfolioProjectMock.d.ts +3 -0
- package/dist/unit.messages.de.d.ts +2 -2
- package/dist/unit.messages.en.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/CreditsAvailableBadge/messages.de.ts +2 -1
- package/src/components/CreditsAvailableBadge/messages.en.ts +2 -1
- package/src/components/SliceRenderer/SliceRenderer.tsx +2 -1
- package/src/components/portfolio/DocumentsDownloadList/messages.de.ts +2 -1
- package/src/components/portfolio/DocumentsDownloadList/messages.en.ts +2 -1
- package/src/components/portfolio/PortfolioProjectCard/PortfolioProjectCard.test.tsx +53 -0
- package/src/components/portfolio/PortfolioProjectCard/PortfolioProjectCard.tsx +69 -0
- package/src/components/portfolio/PortfolioProjectCard/index.ts +3 -0
- package/src/components/portfolio/PortfolioProjectCard/messages.de.ts +8 -0
- package/src/components/portfolio/PortfolioProjectCard/messages.en.ts +8 -0
- package/src/components/portfolio/ProjectInfo/messages.de.ts +2 -1
- package/src/components/portfolio/ProjectInfo/messages.en.ts +2 -1
- package/src/components/portfolio/SmallCheckout/messages.de.ts +2 -1
- package/src/components/portfolio/SmallCheckout/messages.en.ts +2 -1
- package/src/models/PortfolioProject.ts +3 -0
- package/src/models/strapi/StrapiProject.ts +5 -3
- package/src/models/strapi/StrapiProjectCard.ts +2 -12
- package/src/rootMessages.de.ts +2 -0
- package/src/rootMessages.en.ts +2 -0
- package/src/slices/Comparison/messages.de.ts +2 -1
- package/src/slices/Comparison/messages.en.ts +2 -1
- package/src/slices/Cta/Cta.tsx +2 -2
- package/src/slices/Cta/messages.de.ts +2 -1
- package/src/slices/Cta/messages.en.ts +2 -1
- package/src/slices/CustomerStories/messages.de.ts +2 -1
- package/src/slices/CustomerStories/messages.en.ts +2 -1
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.tsx +1 -1
- package/src/slices/FullWidthImageSlider/styles.ts +1 -1
- package/src/slices/Glossary/messages.de.ts +2 -1
- package/src/slices/Glossary/messages.en.ts +2 -1
- package/src/slices/ProjectFacts/messages.de.ts +2 -1
- package/src/slices/ProjectFacts/messages.en.ts +2 -1
- package/src/slices/ProjectsGrid/ProjectsGrid.stories.tsx +2 -56
- package/src/slices/ProjectsGrid/ProjectsGrid.test.tsx +14 -13
- package/src/slices/ProjectsGrid/ProjectsGrid.tsx +46 -62
- package/src/slices/ProjectsMap/mapboxStyle.ts +3 -3
- package/src/slices/ProjectsMap/messages.de.ts +2 -1
- package/src/slices/ProjectsMap/messages.en.ts +2 -1
- package/src/slices/ShopCheckout/messages.de.ts +2 -1
- package/src/slices/ShopCheckout/messages.en.ts +2 -1
- package/src/slices/TextCarousel/TextCarousel.tsx +2 -2
- package/src/slices/TextCarousel/styles.ts +6 -6
- package/src/slices/TextWithCard/TextWithCard.stories.tsx +11 -15
- package/src/slices/TextWithCard/TextWithCard.test.tsx +16 -5
- package/src/slices/TextWithCard/TextWithCard.tsx +10 -18
- package/src/test/integrationMocks/portfolioProjectMock.ts +18 -0
- package/src/test/strapiMocks/strapiProject.ts +7 -0
- package/src/test/strapiMocks/strapiProjectCard.ts +0 -13
- package/src/unit.messages.de.ts +2 -1
- package/src/unit.messages.en.ts +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesDe = {
|
|
2
2
|
'components.creditsAvailableBadge.text.yes': 'Credits verfügbar',
|
|
3
3
|
'components.creditsAvailableBadge.text.some': 'Einige verbleibende Credits',
|
|
4
4
|
'components.creditsAvailableBadge.text.no': 'Keine verbleibenden Credits',
|
|
5
5
|
'components.creditsAvailableBadge.text.notYet':
|
|
6
6
|
'Noch keine Credits verfügbar',
|
|
7
7
|
};
|
|
8
|
+
export default messagesDe;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesEn = {
|
|
2
2
|
'components.creditsAvailableBadge.text.yes': 'Credits available',
|
|
3
3
|
'components.creditsAvailableBadge.text.some': 'Some remaining credits',
|
|
4
4
|
'components.creditsAvailableBadge.text.no': 'No remaining credits',
|
|
5
5
|
'components.creditsAvailableBadge.text.notYet': 'No credits available yet',
|
|
6
6
|
};
|
|
7
|
+
export default messagesEn;
|
|
@@ -92,6 +92,7 @@ export const SliceRenderer = ({
|
|
|
92
92
|
<TextWithCard
|
|
93
93
|
key={`${slice.__component}-${slice.id}`}
|
|
94
94
|
slice={slice}
|
|
95
|
+
projects={projects}
|
|
95
96
|
/>
|
|
96
97
|
);
|
|
97
98
|
case 'sections.logo-grid-with-text':
|
|
@@ -194,7 +195,7 @@ export const SliceRenderer = ({
|
|
|
194
195
|
return (
|
|
195
196
|
<ProjectsGrid
|
|
196
197
|
key={`${slice.__component}-${slice.id}`}
|
|
197
|
-
|
|
198
|
+
projects={projects}
|
|
198
199
|
/>
|
|
199
200
|
);
|
|
200
201
|
case 'sections.projects-map':
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '../../../test/testUtils';
|
|
3
|
+
import PortfolioProjectCard from '.';
|
|
4
|
+
import { PortfolioProjectCardProps } from './PortfolioProjectCard';
|
|
5
|
+
import portfolioProjectMock from '../../../test/integrationMocks/portfolioProjectMock';
|
|
6
|
+
import messagesEn from './messages.en';
|
|
7
|
+
|
|
8
|
+
const defaultProps: PortfolioProjectCardProps = {
|
|
9
|
+
project: portfolioProjectMock,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const setup = (props = {}) => {
|
|
13
|
+
const combinedProps = { ...defaultProps, ...props };
|
|
14
|
+
render(<PortfolioProjectCard {...combinedProps} />);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe('The PortfolioProjectCard component', () => {
|
|
18
|
+
it('displays the project card', () => {
|
|
19
|
+
setup();
|
|
20
|
+
|
|
21
|
+
expect(screen.getByText(portfolioProjectMock.title)).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('displays the area', () => {
|
|
25
|
+
setup();
|
|
26
|
+
|
|
27
|
+
expect(screen.getByText('140 ha')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('displays the location', () => {
|
|
31
|
+
setup();
|
|
32
|
+
|
|
33
|
+
expect(
|
|
34
|
+
screen.getByText(portfolioProjectMock.location as string)
|
|
35
|
+
).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('displays the credits availability', () => {
|
|
39
|
+
setup();
|
|
40
|
+
|
|
41
|
+
expect(
|
|
42
|
+
screen.getByText(messagesEn['components.portfolioProjectCard.text.yes'])
|
|
43
|
+
).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('displays the footer sub title', () => {
|
|
47
|
+
setup();
|
|
48
|
+
|
|
49
|
+
expect(
|
|
50
|
+
screen.getByText(portfolioProjectMock.footerSubTitle as string)
|
|
51
|
+
).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { ProjectCard } from 'boemly';
|
|
3
|
+
import { PortfolioProject, strapiMediaUrl } from '../../..';
|
|
4
|
+
import CreditsAvailableState from '../../../models/CreditsAvailableState';
|
|
5
|
+
import { FORMAT_AS_HECTARE_CONFIG } from '../../../constants/formatter';
|
|
6
|
+
import Image from 'next/image';
|
|
7
|
+
import { IntlContext } from '../../ContextProvider';
|
|
8
|
+
|
|
9
|
+
export interface PortfolioProjectCardProps {
|
|
10
|
+
project: PortfolioProject;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PortfolioProjectCard = ({
|
|
14
|
+
project,
|
|
15
|
+
}: PortfolioProjectCardProps) => {
|
|
16
|
+
const { formatMessage, formatNumber } = useContext(IntlContext);
|
|
17
|
+
|
|
18
|
+
const creditsAvailableMessages: Record<CreditsAvailableState, string> = {
|
|
19
|
+
[CreditsAvailableState.YES]: formatMessage({
|
|
20
|
+
id: 'components.portfolioProjectCard.text.yes',
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
[CreditsAvailableState.SOME]: formatMessage({
|
|
24
|
+
id: 'components.portfolioProjectCard.text.some',
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
[CreditsAvailableState.NO]: formatMessage({
|
|
28
|
+
id: 'components.portfolioProjectCard.text.no',
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
[CreditsAvailableState.NOT_YET]: formatMessage({
|
|
32
|
+
id: 'components.portfolioProjectCard.text.notYet',
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ProjectCard
|
|
38
|
+
title={project.title}
|
|
39
|
+
facts={[
|
|
40
|
+
{
|
|
41
|
+
id: 1,
|
|
42
|
+
text: formatNumber(
|
|
43
|
+
(project.area || 0) / 10000,
|
|
44
|
+
FORMAT_AS_HECTARE_CONFIG
|
|
45
|
+
),
|
|
46
|
+
},
|
|
47
|
+
{ id: 2, text: project.location || '' },
|
|
48
|
+
]}
|
|
49
|
+
footerTitle={
|
|
50
|
+
creditsAvailableMessages[
|
|
51
|
+
project.creditsAvailable ?? CreditsAvailableState.NOT_YET
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
footerSubTitle={project.footerSubTitle || ''}
|
|
55
|
+
image={
|
|
56
|
+
project.thumbnail && (
|
|
57
|
+
<Image
|
|
58
|
+
src={strapiMediaUrl(project.thumbnail?.img, 'medium')}
|
|
59
|
+
alt={project.thumbnail?.alt}
|
|
60
|
+
fill
|
|
61
|
+
style={{
|
|
62
|
+
objectFit: project.thumbnail?.objectFit || 'cover',
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const messagesDe = {
|
|
2
|
+
'components.portfolioProjectCard.text.yes': 'Credits verfügbar',
|
|
3
|
+
'components.portfolioProjectCard.text.some': 'Einige verbleibende Credits',
|
|
4
|
+
'components.portfolioProjectCard.text.no': 'Keine verbleibenden Credits',
|
|
5
|
+
'components.portfolioProjectCard.text.notYet': 'Noch keine Credits verfügbar',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default messagesDe;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const messagesEn = {
|
|
2
|
+
'components.portfolioProjectCard.text.yes': 'Credits available',
|
|
3
|
+
'components.portfolioProjectCard.text.some': 'Some remaining credits',
|
|
4
|
+
'components.portfolioProjectCard.text.no': 'No remaining credits',
|
|
5
|
+
'components.portfolioProjectCard.text.notYet': 'No credits available yet',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default messagesEn;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesDe = {
|
|
2
2
|
'features.projectInfo.projectInfo.value': 'Projekt Infos',
|
|
3
3
|
'features.projectInfo.properties.area': 'Projekt Fläche',
|
|
4
4
|
'features.projectInfo.properties.location': 'Standort',
|
|
@@ -17,3 +17,4 @@ export default {
|
|
|
17
17
|
'features.projectInfo.properties.year':
|
|
18
18
|
'{years} {years, plural, one {Jahr} other {Jahre} }',
|
|
19
19
|
};
|
|
20
|
+
export default messagesDe;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesEn = {
|
|
2
2
|
'features.projectInfo.projectInfo.value': 'Project Infos',
|
|
3
3
|
'features.projectInfo.properties.area': 'Project Area',
|
|
4
4
|
'features.projectInfo.properties.location': 'Location',
|
|
@@ -17,3 +17,4 @@ export default {
|
|
|
17
17
|
'features.projectInfo.properties.year':
|
|
18
18
|
'{years} {years, plural, one {year} other {years} }',
|
|
19
19
|
};
|
|
20
|
+
export default messagesEn;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesDe = {
|
|
2
2
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF':
|
|
3
3
|
'Geben Sie den Beitrag in Fr. ein',
|
|
4
4
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR':
|
|
@@ -24,3 +24,4 @@ export default {
|
|
|
24
24
|
'Für Unternehmenskunden bieten wir individuelle Lösungen an. Kontaktieren Sie uns.',
|
|
25
25
|
'portfolio.smallCheckout.cta.button': 'Unser Vertriebsteam kontaktieren',
|
|
26
26
|
};
|
|
27
|
+
export default messagesDe;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesEn = {
|
|
2
2
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF':
|
|
3
3
|
'Contribution Amount in CHF',
|
|
4
4
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR':
|
|
@@ -24,3 +24,4 @@ export default {
|
|
|
24
24
|
'For enterprise-customers we offer custom solutions. Feel free to contact us.',
|
|
25
25
|
'portfolio.smallCheckout.cta.button': 'Contact our Sales Team',
|
|
26
26
|
};
|
|
27
|
+
export default messagesEn;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { StrapiImage } from '..';
|
|
1
2
|
import CreditsAvailableState from './CreditsAvailableState';
|
|
2
3
|
import FPMProject from './fpm/FPMProject';
|
|
3
4
|
|
|
4
5
|
interface PortfolioProject extends FPMProject {
|
|
5
6
|
slug?: string;
|
|
7
|
+
thumbnail?: StrapiImage | null;
|
|
6
8
|
creditsAvailable?: CreditsAvailableState;
|
|
9
|
+
footerSubTitle?: string;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
export default PortfolioProject;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import CreditsAvailableState from '../CreditsAvailableState';
|
|
2
2
|
import Locale from '../Locale';
|
|
3
|
+
import IStrapi from './IStrapi';
|
|
3
4
|
import IStrapiData from './IStrapiData';
|
|
5
|
+
import StrapiImage from './StrapiImage';
|
|
4
6
|
import StrapiLocalization from './StrapiLocalization';
|
|
5
7
|
import StrapiMetadata from './StrapiMetadata';
|
|
6
8
|
import StrapiPortfolio from './StrapiPortfolio';
|
|
@@ -11,14 +13,14 @@ interface StrapiProject {
|
|
|
11
13
|
locale: Locale;
|
|
12
14
|
fpmProjectId?: string;
|
|
13
15
|
creditsAvailable?: CreditsAvailableState;
|
|
16
|
+
footerSubTitle?: string;
|
|
14
17
|
createdAt: string;
|
|
15
18
|
updatedAt: string;
|
|
16
19
|
metadata: StrapiMetadata | null;
|
|
20
|
+
thumbnail: StrapiImage | null;
|
|
17
21
|
slices: any[];
|
|
18
22
|
localizations: StrapiLocalization[];
|
|
19
|
-
portfolio:
|
|
20
|
-
data?: IStrapiData<StrapiPortfolio>;
|
|
21
|
-
};
|
|
23
|
+
portfolio: IStrapi<IStrapiData<StrapiPortfolio>>;
|
|
22
24
|
topBanner?: StrapiTopBanner;
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
+
import IStrapi from './IStrapi';
|
|
1
2
|
import IStrapiData from './IStrapiData';
|
|
2
|
-
import StrapiImage from './StrapiImage';
|
|
3
3
|
import StrapiProject from './StrapiProject';
|
|
4
4
|
|
|
5
5
|
interface StrapiProjectCard {
|
|
6
6
|
id: number;
|
|
7
|
-
|
|
8
|
-
facts: {
|
|
9
|
-
id: number;
|
|
10
|
-
text: string;
|
|
11
|
-
}[];
|
|
12
|
-
footerTitle: string;
|
|
13
|
-
footerSubTitle: string;
|
|
14
|
-
image: StrapiImage;
|
|
15
|
-
project?: {
|
|
16
|
-
data?: IStrapiData<StrapiProject>;
|
|
17
|
-
};
|
|
7
|
+
project: IStrapi<IStrapiData<StrapiProject>>;
|
|
18
8
|
}
|
|
19
9
|
|
|
20
10
|
export default StrapiProjectCard;
|
package/src/rootMessages.de.ts
CHANGED
|
@@ -9,6 +9,7 @@ import creditsAvailableBadgeMessagesDe from './components/CreditsAvailableBadge/
|
|
|
9
9
|
import portfolioDocumentsDownloadListMessagesDe from './components/portfolio/DocumentsDownloadList/messages.de';
|
|
10
10
|
import portfolioProjectInfoMessagesDe from './components/portfolio/ProjectInfo/messages.de';
|
|
11
11
|
import portfolioSmallCheckoutMessagesDe from './components/portfolio/SmallCheckout/messages.de';
|
|
12
|
+
import portfolioProjectCardMessagesDe from './components/portfolio/PortfolioProjectCard/messages.de';
|
|
12
13
|
|
|
13
14
|
import unitMessagesDe from './unit.messages.en';
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ const rootMessagesDe = {
|
|
|
18
19
|
//
|
|
19
20
|
...creditsAvailableBadgeMessagesDe,
|
|
20
21
|
...portfolioDocumentsDownloadListMessagesDe,
|
|
22
|
+
...portfolioProjectCardMessagesDe,
|
|
21
23
|
...portfolioProjectInfoMessagesDe,
|
|
22
24
|
...portfolioSmallCheckoutMessagesDe,
|
|
23
25
|
|
package/src/rootMessages.en.ts
CHANGED
|
@@ -9,6 +9,7 @@ import creditsAvailableBadgeMessagesEn from './components/CreditsAvailableBadge/
|
|
|
9
9
|
import portfolioDocumentsDownloadListMessagesEn from './components/portfolio/DocumentsDownloadList/messages.en';
|
|
10
10
|
import portfolioProjectInfoMessagesEn from './components/portfolio/ProjectInfo/messages.en';
|
|
11
11
|
import portfolioSmallCheckoutMessagesEn from './components/portfolio/SmallCheckout/messages.en';
|
|
12
|
+
import portfolioProjectCardMessagesEn from './components/portfolio/PortfolioProjectCard/messages.en';
|
|
12
13
|
|
|
13
14
|
import unitMessagesEn from './unit.messages.en';
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ const rootMessagesEn = {
|
|
|
18
19
|
//
|
|
19
20
|
...creditsAvailableBadgeMessagesEn,
|
|
20
21
|
...portfolioDocumentsDownloadListMessagesEn,
|
|
22
|
+
...portfolioProjectCardMessagesEn,
|
|
21
23
|
...portfolioProjectInfoMessagesEn,
|
|
22
24
|
...portfolioSmallCheckoutMessagesEn,
|
|
23
25
|
|
package/src/slices/Cta/Cta.tsx
CHANGED
|
@@ -300,7 +300,7 @@ export const Cta: React.FC<CtaProps> = ({ slice }: CtaProps) => {
|
|
|
300
300
|
minWidth={[null, null, null, null, '50%']}
|
|
301
301
|
>
|
|
302
302
|
<Image
|
|
303
|
-
src={strapiMediaUrl(ctaCard.image.img, '
|
|
303
|
+
src={strapiMediaUrl(ctaCard.image.img, 'xLarge')}
|
|
304
304
|
alt={ctaCard.image.alt}
|
|
305
305
|
fill
|
|
306
306
|
style={{
|
|
@@ -390,7 +390,7 @@ export const Cta: React.FC<CtaProps> = ({ slice }: CtaProps) => {
|
|
|
390
390
|
minWidth={[null, null, null, null, '50%']}
|
|
391
391
|
>
|
|
392
392
|
<Image
|
|
393
|
-
src={strapiMediaUrl(ctaCard.image.img, '
|
|
393
|
+
src={strapiMediaUrl(ctaCard.image.img, 'xLarge')}
|
|
394
394
|
alt={ctaCard.image.alt}
|
|
395
395
|
fill
|
|
396
396
|
style={{
|
|
@@ -97,7 +97,7 @@ export const FullWidthImageSlider: React.FC<FullWidthImageSliderProps> = ({
|
|
|
97
97
|
</SliderInnerContainer>
|
|
98
98
|
</SliderContainer>
|
|
99
99
|
|
|
100
|
-
<ButtonsContainer show={allowScroll && !isOpen}>
|
|
100
|
+
<ButtonsContainer show={(allowScroll && !isOpen).toString()}>
|
|
101
101
|
<Box>
|
|
102
102
|
<AnimatePresence>
|
|
103
103
|
{canMoveLeft && (
|
|
@@ -26,7 +26,7 @@ export const SliderContainer = styled(Box)`
|
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
28
|
interface ButtonsContainerProps {
|
|
29
|
-
show:
|
|
29
|
+
show: string;
|
|
30
30
|
}
|
|
31
31
|
export const ButtonsContainer = styled(Box)<ButtonsContainerProps>`
|
|
32
32
|
display: ${({ show }: ButtonsContainerProps) => (show ? 'flex' : 'none')};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesDe = {
|
|
2
2
|
'sections.glossary.copyButtonLabel':
|
|
3
3
|
'Kopiere den Link zu diesem Abschnitt in die Zwischenablage',
|
|
4
4
|
'sections.glossary.copySuccessMessage': 'Link in die Zwischenablage kopiert',
|
|
5
5
|
'sections.glossary.copyFailureMessage':
|
|
6
6
|
'Link konnte nicht in die Zwischenablage kopiert werden',
|
|
7
7
|
};
|
|
8
|
+
export default messagesDe;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesEn = {
|
|
2
2
|
'sections.glossary.copyButtonLabel':
|
|
3
3
|
'Copy a link to this section to your clipboard',
|
|
4
4
|
'sections.glossary.copySuccessMessage': 'Copied the link to your clipboard',
|
|
5
5
|
'sections.glossary.copyFailureMessage': 'Could not copy link to clipboard',
|
|
6
6
|
};
|
|
7
|
+
export default messagesEn;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StoryFn, Meta } from '@storybook/react';
|
|
3
3
|
|
|
4
|
-
import { storybookStrapiCoverMock } from '../../test/storybookMocks/storybookStrapiMedia';
|
|
5
|
-
import Locale from '../../models/Locale';
|
|
6
4
|
import ProjectsGrid from '.';
|
|
5
|
+
import portfolioProjectMock from '../../test/integrationMocks/portfolioProjectMock';
|
|
7
6
|
|
|
8
7
|
export default {
|
|
9
8
|
title: 'slices/ProjectsGrid',
|
|
@@ -14,60 +13,7 @@ const Template: StoryFn<typeof ProjectsGrid> = (args) => (
|
|
|
14
13
|
<ProjectsGrid {...args} />
|
|
15
14
|
);
|
|
16
15
|
|
|
17
|
-
const card = {
|
|
18
|
-
id: 1,
|
|
19
|
-
image: {
|
|
20
|
-
id: 1,
|
|
21
|
-
alt: 'Image alt text',
|
|
22
|
-
img: { data: storybookStrapiCoverMock },
|
|
23
|
-
},
|
|
24
|
-
title: 'Card title',
|
|
25
|
-
facts: [
|
|
26
|
-
{ id: 1, text: 'Fact 1' },
|
|
27
|
-
{ id: 2, text: 'Fact 2' },
|
|
28
|
-
],
|
|
29
|
-
footerTitle: 'Footer title',
|
|
30
|
-
footerSubTitle: 'Footer sub title',
|
|
31
|
-
project: {
|
|
32
|
-
data: {
|
|
33
|
-
id: 1,
|
|
34
|
-
attributes: {
|
|
35
|
-
slug: 'slug',
|
|
36
|
-
metadata: null,
|
|
37
|
-
slices: [],
|
|
38
|
-
locale: 'en' as Locale,
|
|
39
|
-
createdAt: '2020-01-01T00:00:00.000Z',
|
|
40
|
-
updatedAt: '2020-01-01T00:00:00.000Z',
|
|
41
|
-
localizations: [],
|
|
42
|
-
portfolio: { data: undefined },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
16
|
export const Minimal = Template.bind({});
|
|
49
17
|
Minimal.args = {
|
|
50
|
-
|
|
51
|
-
projects: [
|
|
52
|
-
{
|
|
53
|
-
...card,
|
|
54
|
-
project: {
|
|
55
|
-
data: {
|
|
56
|
-
...card.project.data,
|
|
57
|
-
attributes: { ...card.project.data.attributes, slug: 'slug-1' },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
...card,
|
|
63
|
-
id: 2,
|
|
64
|
-
project: {
|
|
65
|
-
data: {
|
|
66
|
-
...card.project.data,
|
|
67
|
-
attributes: { ...card.project.data.attributes, slug: 'slug-2' },
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
18
|
+
projects: [portfolioProjectMock],
|
|
73
19
|
};
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '../../test/testUtils';
|
|
3
|
-
import { strapiProjectCardMock } from '../../test/strapiMocks/strapiProjectCard';
|
|
4
3
|
import ProjectsGrid from '.';
|
|
5
4
|
import { ProjectsGridProps } from './ProjectsGrid';
|
|
5
|
+
import fpmProjectMock from '../../test/integrationMocks/fpmProjectMock';
|
|
6
|
+
import { strapiMediaMock } from '../../test/strapiMocks/strapiMedia';
|
|
7
|
+
import CreditsAvailableState from '../../models/CreditsAvailableState';
|
|
6
8
|
|
|
7
9
|
const defaultProps: ProjectsGridProps = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
projects: [
|
|
11
|
+
{
|
|
12
|
+
...fpmProjectMock,
|
|
13
|
+
slug: 'slug',
|
|
14
|
+
isPublic: true,
|
|
15
|
+
thumbnail: { img: { data: strapiMediaMock }, alt: 'Alt Text', id: 1 },
|
|
16
|
+
footerSubTitle: 'certified-123',
|
|
17
|
+
creditsAvailable: CreditsAvailableState.YES,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
11
20
|
};
|
|
12
21
|
|
|
13
22
|
const setup = (props = {}) => {
|
|
@@ -19,14 +28,6 @@ describe('The ProjectsGrid component', () => {
|
|
|
19
28
|
it('displays the project cards', () => {
|
|
20
29
|
setup();
|
|
21
30
|
|
|
22
|
-
expect(
|
|
23
|
-
screen.getByText(defaultProps.slice.projects[0].title)
|
|
24
|
-
).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('displays a link to a project', () => {
|
|
28
|
-
setup();
|
|
29
|
-
|
|
30
|
-
expect(screen.getByRole('link')).toHaveAttribute('href', '/portfolio/slug');
|
|
31
|
+
expect(screen.getByText(fpmProjectMock.title)).toBeInTheDocument();
|
|
31
32
|
});
|
|
32
33
|
});
|