@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
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
DefaultSectionContainer,
|
|
5
|
-
ProjectCard,
|
|
6
|
-
SimpleGrid,
|
|
7
|
-
Wrapper,
|
|
8
|
-
} from 'boemly';
|
|
9
|
-
import Image from 'next/image';
|
|
2
|
+
import { Box, DefaultSectionContainer, SimpleGrid, Wrapper } from 'boemly';
|
|
10
3
|
import Link from 'next/link';
|
|
11
4
|
import { MEDIUM_TRANSITION_DURATION } from '../../constants/animations';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
5
|
+
import PortfolioProject from '../../models/PortfolioProject';
|
|
6
|
+
import PortfolioProjectCard from '../../components/portfolio/PortfolioProjectCard';
|
|
14
7
|
|
|
15
8
|
export interface ProjectsGridProps {
|
|
16
|
-
|
|
17
|
-
projects: StrapiProjectCard[];
|
|
18
|
-
};
|
|
9
|
+
projects: PortfolioProject[];
|
|
19
10
|
}
|
|
20
11
|
|
|
21
12
|
const ConditionalWrapper = ({
|
|
@@ -29,53 +20,46 @@ const ConditionalWrapper = ({
|
|
|
29
20
|
}) => (condition ? wrapper(children) : children);
|
|
30
21
|
|
|
31
22
|
export const ProjectsGrid: React.FC<ProjectsGridProps> = ({
|
|
32
|
-
|
|
33
|
-
}: ProjectsGridProps) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
width="fit-content"
|
|
57
|
-
height="fit-content"
|
|
58
|
-
transition={`box-shadow ease ${MEDIUM_TRANSITION_DURATION}s`}
|
|
59
|
-
_hover={{ boxShadow: 'lg' }}
|
|
23
|
+
projects,
|
|
24
|
+
}: ProjectsGridProps) => {
|
|
25
|
+
const filteredProjects = projects.filter(
|
|
26
|
+
(p) => p.thumbnail && p.slug && p.isPublic
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<DefaultSectionContainer>
|
|
31
|
+
<Wrapper>
|
|
32
|
+
<SimpleGrid columns={[1, null, null, 2, null, 3]} gap="16">
|
|
33
|
+
{filteredProjects.map((project) => (
|
|
34
|
+
<ConditionalWrapper
|
|
35
|
+
key={project.id}
|
|
36
|
+
condition={!!project.slug}
|
|
37
|
+
wrapper={(children: JSX.Element) => (
|
|
38
|
+
<Link
|
|
39
|
+
href={`/portfolio/${project.slug}`}
|
|
40
|
+
passHref
|
|
41
|
+
key={project.id}
|
|
42
|
+
legacyBehavior
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</Link>
|
|
46
|
+
)}
|
|
60
47
|
>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</Wrapper>
|
|
80
|
-
</DefaultSectionContainer>
|
|
81
|
-
);
|
|
48
|
+
<Box
|
|
49
|
+
as="a"
|
|
50
|
+
cursor="pointer"
|
|
51
|
+
borderRadius="2xl"
|
|
52
|
+
width="fit-content"
|
|
53
|
+
height="fit-content"
|
|
54
|
+
transition={`box-shadow ease ${MEDIUM_TRANSITION_DURATION}s`}
|
|
55
|
+
_hover={{ boxShadow: 'lg' }}
|
|
56
|
+
>
|
|
57
|
+
<PortfolioProjectCard project={project} />
|
|
58
|
+
</Box>
|
|
59
|
+
</ConditionalWrapper>
|
|
60
|
+
))}
|
|
61
|
+
</SimpleGrid>
|
|
62
|
+
</Wrapper>
|
|
63
|
+
</DefaultSectionContainer>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -142,13 +142,13 @@ const mapboxStyle = css`
|
|
|
142
142
|
.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon {
|
|
143
143
|
opacity: 0.25;
|
|
144
144
|
}
|
|
145
|
-
.mapboxgl-ctrl-group button:first-
|
|
145
|
+
.mapboxgl-ctrl-group button:first-of-type {
|
|
146
146
|
border-radius: 4px 4px 0 0;
|
|
147
147
|
}
|
|
148
|
-
.mapboxgl-ctrl-group button:last-
|
|
148
|
+
.mapboxgl-ctrl-group button:last-of-type {
|
|
149
149
|
border-radius: 0 0 4px 4px;
|
|
150
150
|
}
|
|
151
|
-
.mapboxgl-ctrl-group button:only-
|
|
151
|
+
.mapboxgl-ctrl-group button:only-of-type {
|
|
152
152
|
border-radius: inherit;
|
|
153
153
|
}
|
|
154
154
|
.mapboxgl-ctrl button:not(:disabled):hover {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesDe = {
|
|
2
2
|
'sections.shopCheckout.intro.price': 'Preis',
|
|
3
3
|
|
|
4
4
|
'sections.shopCheckout.contributionValue.label.EUR':
|
|
@@ -21,3 +21,4 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
'sections.shopCheckout.submit': 'Kaufen',
|
|
23
23
|
};
|
|
24
|
+
export default messagesDe;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const messagesEn = {
|
|
2
2
|
'sections.shopCheckout.intro.price': 'Price',
|
|
3
3
|
|
|
4
4
|
'sections.shopCheckout.contributionValue.label.EUR':
|
|
@@ -21,3 +21,4 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
'sections.shopCheckout.submit': 'Checkout',
|
|
23
23
|
};
|
|
24
|
+
export default messagesEn;
|
|
@@ -51,10 +51,10 @@ export const TextCarousel: React.FC<TextCarouselProps> = ({
|
|
|
51
51
|
<CarouselInnerContainer
|
|
52
52
|
drag="x"
|
|
53
53
|
dragConstraints={containerRef}
|
|
54
|
-
|
|
54
|
+
numberofitems={slice.slides.length}
|
|
55
55
|
>
|
|
56
56
|
{slice.slides.map(({ id, title, text, icon }) => (
|
|
57
|
-
<CardContainer key={id}
|
|
57
|
+
<CardContainer key={id} numberofitems={slice.slides.length}>
|
|
58
58
|
<TextCardWithIcon
|
|
59
59
|
title={title}
|
|
60
60
|
text={text}
|
|
@@ -20,7 +20,7 @@ export const CarouselContainer = styled(Box)`
|
|
|
20
20
|
`;
|
|
21
21
|
|
|
22
22
|
interface CarouselInnerContainerProps {
|
|
23
|
-
|
|
23
|
+
numberofitems: number;
|
|
24
24
|
}
|
|
25
25
|
export const CarouselInnerContainer = styled(
|
|
26
26
|
motion.div
|
|
@@ -29,7 +29,7 @@ export const CarouselInnerContainer = styled(
|
|
|
29
29
|
justify-content: center;
|
|
30
30
|
width: calc(
|
|
31
31
|
(var(--boemly-sizes-sm) + var(--boemly-space-16)) *
|
|
32
|
-
${({
|
|
32
|
+
${({ numberofitems }: CarouselInnerContainerProps) => numberofitems} +
|
|
33
33
|
var(--boemly-space-16)
|
|
34
34
|
);
|
|
35
35
|
min-width: var(--boemly-sizes-full);
|
|
@@ -37,18 +37,18 @@ export const CarouselInnerContainer = styled(
|
|
|
37
37
|
@media screen and (max-width: ${BREAKPOINT_MD}) {
|
|
38
38
|
width: calc(
|
|
39
39
|
(var(--boemly-sizes-xs) + var(--boemly-space-4)) *
|
|
40
|
-
${({
|
|
40
|
+
${({ numberofitems }: CarouselInnerContainerProps) => numberofitems} +
|
|
41
41
|
var(--boemly-space-6)
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
|
|
46
46
|
interface CardContainerProps {
|
|
47
|
-
|
|
47
|
+
numberofitems: number;
|
|
48
48
|
}
|
|
49
49
|
export const CardContainer = styled(Box)<CardContainerProps>`
|
|
50
|
-
width: ${({
|
|
51
|
-
|
|
50
|
+
width: ${({ numberofitems }: CardContainerProps) =>
|
|
51
|
+
numberofitems === 3 ? 'var(--boemly-sizes-xl)' : 'var(--boemly-sizes-sm)'};
|
|
52
52
|
|
|
53
53
|
margin-right: var(--boemly-space-16);
|
|
54
54
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StoryFn, Meta } from '@storybook/react';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import portfolioProjectMock from '../../test/integrationMocks/portfolioProjectMock';
|
|
5
|
+
import { strapiProjectMock } from '../../test/strapiMocks/strapiProject';
|
|
5
6
|
import TextWithCard from '.';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
@@ -21,21 +22,9 @@ const listItems = [
|
|
|
21
22
|
const button = { id: 1, text: 'Button', url: 'https://tree.ly' };
|
|
22
23
|
const card = {
|
|
23
24
|
id: 1,
|
|
24
|
-
|
|
25
|
-
id: 1,
|
|
26
|
-
alt: 'Image alt text',
|
|
27
|
-
img: { data: storybookStrapiCoverMock },
|
|
28
|
-
},
|
|
29
|
-
title: 'Card title',
|
|
30
|
-
facts: [
|
|
31
|
-
{ id: 1, text: 'Fact 1' },
|
|
32
|
-
{ id: 2, text: 'Fact 2' },
|
|
33
|
-
{ id: 3, text: 'Fact 3' },
|
|
34
|
-
{ id: 4, text: 'Fact 4' },
|
|
35
|
-
],
|
|
36
|
-
footerTitle: 'Footer title',
|
|
37
|
-
footerSubTitle: 'Footer sub title',
|
|
25
|
+
project: { data: strapiProjectMock },
|
|
38
26
|
};
|
|
27
|
+
const projects = [{ ...portfolioProjectMock, slug: 'slug' }];
|
|
39
28
|
|
|
40
29
|
export const Minimal = Template.bind({});
|
|
41
30
|
Minimal.args = {
|
|
@@ -43,6 +32,7 @@ Minimal.args = {
|
|
|
43
32
|
title: 'Title',
|
|
44
33
|
cardPosition: 'left',
|
|
45
34
|
},
|
|
35
|
+
projects,
|
|
46
36
|
};
|
|
47
37
|
|
|
48
38
|
export const WithTagline = Template.bind({});
|
|
@@ -52,6 +42,7 @@ WithTagline.args = {
|
|
|
52
42
|
title: 'Title',
|
|
53
43
|
cardPosition: 'left',
|
|
54
44
|
},
|
|
45
|
+
projects,
|
|
55
46
|
};
|
|
56
47
|
|
|
57
48
|
export const WithTaglineAndText = Template.bind({});
|
|
@@ -62,6 +53,7 @@ WithTaglineAndText.args = {
|
|
|
62
53
|
text: 'Text',
|
|
63
54
|
cardPosition: 'left',
|
|
64
55
|
},
|
|
56
|
+
projects,
|
|
65
57
|
};
|
|
66
58
|
|
|
67
59
|
export const WithList = Template.bind({});
|
|
@@ -73,6 +65,7 @@ WithList.args = {
|
|
|
73
65
|
listItems,
|
|
74
66
|
cardPosition: 'left',
|
|
75
67
|
},
|
|
68
|
+
projects,
|
|
76
69
|
};
|
|
77
70
|
|
|
78
71
|
export const WithButton = Template.bind({});
|
|
@@ -85,6 +78,7 @@ WithButton.args = {
|
|
|
85
78
|
button,
|
|
86
79
|
cardPosition: 'left',
|
|
87
80
|
},
|
|
81
|
+
projects,
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
export const WithCard = Template.bind({});
|
|
@@ -98,6 +92,7 @@ WithCard.args = {
|
|
|
98
92
|
card,
|
|
99
93
|
cardPosition: 'left',
|
|
100
94
|
},
|
|
95
|
+
projects,
|
|
101
96
|
};
|
|
102
97
|
|
|
103
98
|
export const WithCardOnRight = Template.bind({});
|
|
@@ -111,4 +106,5 @@ WithCardOnRight.args = {
|
|
|
111
106
|
card,
|
|
112
107
|
cardPosition: 'right',
|
|
113
108
|
},
|
|
109
|
+
projects,
|
|
114
110
|
};
|
|
@@ -3,6 +3,9 @@ import { render, screen } from '../../test/testUtils';
|
|
|
3
3
|
import { strapiProjectCardMock } from '../../test/strapiMocks/strapiProjectCard';
|
|
4
4
|
import TextWithCard from '.';
|
|
5
5
|
import { TextWithCardProps } from './TextWithCard';
|
|
6
|
+
import fpmProjectMock from '../../test/integrationMocks/fpmProjectMock';
|
|
7
|
+
import { strapiMediaMock } from '../../test/strapiMocks/strapiMedia';
|
|
8
|
+
import CreditsAvailableState from '../../models/CreditsAvailableState';
|
|
6
9
|
|
|
7
10
|
const defaultProps: TextWithCardProps = {
|
|
8
11
|
slice: {
|
|
@@ -11,6 +14,16 @@ const defaultProps: TextWithCardProps = {
|
|
|
11
14
|
text: 'Text',
|
|
12
15
|
cardPosition: 'left',
|
|
13
16
|
},
|
|
17
|
+
projects: [
|
|
18
|
+
{
|
|
19
|
+
...fpmProjectMock,
|
|
20
|
+
slug: 'slug',
|
|
21
|
+
isPublic: true,
|
|
22
|
+
thumbnail: { img: { data: strapiMediaMock }, alt: 'Alt Text', id: 1 },
|
|
23
|
+
footerSubTitle: 'certified-123',
|
|
24
|
+
creditsAvailable: CreditsAvailableState.YES,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
14
27
|
};
|
|
15
28
|
|
|
16
29
|
const setup = (props = {}) => {
|
|
@@ -61,17 +74,15 @@ describe('The TextWithCard component', () => {
|
|
|
61
74
|
it('displays no card if there is no card in the slice', () => {
|
|
62
75
|
setup();
|
|
63
76
|
|
|
64
|
-
expect(
|
|
65
|
-
screen.queryByText(strapiProjectCardMock.title)
|
|
66
|
-
).not.toBeInTheDocument();
|
|
77
|
+
expect(screen.queryByText(fpmProjectMock.title)).not.toBeInTheDocument();
|
|
67
78
|
});
|
|
68
79
|
|
|
69
|
-
it('displays
|
|
80
|
+
it('displays the card if a project has been selected', () => {
|
|
70
81
|
setup({
|
|
71
82
|
slice: { ...defaultProps.slice, card: strapiProjectCardMock },
|
|
72
83
|
});
|
|
73
84
|
|
|
74
|
-
expect(screen.getByText(
|
|
85
|
+
expect(screen.getByText(fpmProjectMock.title)).toBeInTheDocument();
|
|
75
86
|
});
|
|
76
87
|
|
|
77
88
|
const cardPositions = ['left', 'right'];
|
|
@@ -4,17 +4,16 @@ import {
|
|
|
4
4
|
DefaultSectionHeader,
|
|
5
5
|
Grid,
|
|
6
6
|
GridItem,
|
|
7
|
-
ProjectCard,
|
|
8
7
|
Spacer,
|
|
9
8
|
BoemlyList,
|
|
10
9
|
Wrapper,
|
|
11
10
|
} from 'boemly';
|
|
12
|
-
import Image from 'next/image';
|
|
13
11
|
import { ArrowRight } from '@phosphor-icons/react';
|
|
14
|
-
import strapiMediaUrl from '../../utils/strapiMediaUrl';
|
|
15
12
|
import StrapiLink from '../../models/strapi/StrapiLink';
|
|
16
13
|
import StrapiProjectCard from '../../models/strapi/StrapiProjectCard';
|
|
17
14
|
import StrapiLinkButton from '../../components/StrapiLinkButton';
|
|
15
|
+
import PortfolioProject from '../../models/PortfolioProject';
|
|
16
|
+
import PortfolioProjectCard from '../../components/portfolio/PortfolioProjectCard';
|
|
18
17
|
|
|
19
18
|
interface TextWithCardSlice {
|
|
20
19
|
tagline?: string;
|
|
@@ -30,11 +29,17 @@ interface TextWithCardSlice {
|
|
|
30
29
|
}
|
|
31
30
|
export interface TextWithCardProps {
|
|
32
31
|
slice: TextWithCardSlice;
|
|
32
|
+
projects: PortfolioProject[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const TextWithCard: React.FC<TextWithCardProps> = ({
|
|
36
36
|
slice,
|
|
37
|
+
projects,
|
|
37
38
|
}: TextWithCardProps) => {
|
|
39
|
+
const fpmData = projects.find(
|
|
40
|
+
(project) => project.slug === slice.card?.project?.data.attributes.slug
|
|
41
|
+
);
|
|
42
|
+
|
|
38
43
|
const card = (
|
|
39
44
|
<GridItem
|
|
40
45
|
colSpan={[4, null, null, null, 2]}
|
|
@@ -42,21 +47,8 @@ export const TextWithCard: React.FC<TextWithCardProps> = ({
|
|
|
42
47
|
position="relative"
|
|
43
48
|
data-testid={`card-position-${slice.cardPosition}`}
|
|
44
49
|
>
|
|
45
|
-
{slice.card && (
|
|
46
|
-
<
|
|
47
|
-
facts={slice.card.facts}
|
|
48
|
-
footerSubTitle={slice.card.footerSubTitle}
|
|
49
|
-
footerTitle={slice.card.footerTitle}
|
|
50
|
-
title={slice.card.title}
|
|
51
|
-
image={
|
|
52
|
-
<Image
|
|
53
|
-
src={strapiMediaUrl(slice.card.image.img, 'medium')}
|
|
54
|
-
alt={slice.card.image.alt}
|
|
55
|
-
fill
|
|
56
|
-
style={{ objectFit: slice.card.image.objectFit || 'cover' }}
|
|
57
|
-
/>
|
|
58
|
-
}
|
|
59
|
-
/>
|
|
50
|
+
{slice.card && fpmData && (
|
|
51
|
+
<PortfolioProjectCard project={{ ...slice.card, ...fpmData }} />
|
|
60
52
|
)}
|
|
61
53
|
</GridItem>
|
|
62
54
|
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PortfolioProject } from '../..';
|
|
2
|
+
import fpmProjectMock from './fpmProjectMock';
|
|
3
|
+
import { strapiProjectMock } from '../strapiMocks/strapiProject';
|
|
4
|
+
import { storybookStrapiCoverMock } from '../storybookMocks/storybookStrapiMedia';
|
|
5
|
+
|
|
6
|
+
const portfolioProjectMock: PortfolioProject = {
|
|
7
|
+
...strapiProjectMock.attributes,
|
|
8
|
+
...fpmProjectMock,
|
|
9
|
+
isPublic: true,
|
|
10
|
+
footerSubTitle: 'Certified, 2023',
|
|
11
|
+
thumbnail: {
|
|
12
|
+
id: 1,
|
|
13
|
+
img: { data: storybookStrapiCoverMock },
|
|
14
|
+
alt: 'Project Thumbnail',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default portfolioProjectMock;
|
|
@@ -3,6 +3,7 @@ import StrapiProject from '../../models/strapi/StrapiProject';
|
|
|
3
3
|
import CreditsAvailableState from '../../models/CreditsAvailableState';
|
|
4
4
|
import { strapiPortfolioMock } from './strapiPortfolioMock';
|
|
5
5
|
import fpmProjectMock from '../integrationMocks/fpmProjectMock';
|
|
6
|
+
import { strapiMediaMock } from './strapiMedia';
|
|
6
7
|
|
|
7
8
|
export const strapiProjectMock: IStrapiData<StrapiProject> = {
|
|
8
9
|
id: 1,
|
|
@@ -11,6 +12,7 @@ export const strapiProjectMock: IStrapiData<StrapiProject> = {
|
|
|
11
12
|
locale: 'en',
|
|
12
13
|
fpmProjectId: fpmProjectMock.id,
|
|
13
14
|
creditsAvailable: CreditsAvailableState.YES,
|
|
15
|
+
footerSubTitle: 'Certified, 2023',
|
|
14
16
|
createdAt: '2022-01-10T15:04:32.897Z',
|
|
15
17
|
updatedAt: '2022-01-11T10:21:42.317Z',
|
|
16
18
|
metadata: null,
|
|
@@ -24,6 +26,11 @@ export const strapiProjectMock: IStrapiData<StrapiProject> = {
|
|
|
24
26
|
portfolio: {
|
|
25
27
|
data: strapiPortfolioMock,
|
|
26
28
|
},
|
|
29
|
+
thumbnail: {
|
|
30
|
+
img: { data: strapiMediaMock },
|
|
31
|
+
alt: 'Project Thumbnail',
|
|
32
|
+
id: 1,
|
|
33
|
+
},
|
|
27
34
|
localizations: [
|
|
28
35
|
{
|
|
29
36
|
id: 2,
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import StrapiProjectCard from '../../models/strapi/StrapiProjectCard';
|
|
2
|
-
import { strapiMediaMock } from './strapiMedia';
|
|
3
2
|
import { strapiProjectMock } from './strapiProject';
|
|
4
3
|
|
|
5
4
|
export const strapiProjectCardMock: StrapiProjectCard = {
|
|
6
5
|
id: 1,
|
|
7
|
-
title: 'My forest',
|
|
8
|
-
facts: [
|
|
9
|
-
{ id: 1, text: 'text1' },
|
|
10
|
-
{ id: 2, text: 'text2' },
|
|
11
|
-
],
|
|
12
|
-
footerTitle: 'Footer title',
|
|
13
|
-
footerSubTitle: 'Footer sub title',
|
|
14
|
-
image: {
|
|
15
|
-
id: 1,
|
|
16
|
-
alt: 'Alt text',
|
|
17
|
-
img: { data: strapiMediaMock },
|
|
18
|
-
},
|
|
19
6
|
project: { data: strapiProjectMock },
|
|
20
7
|
};
|
package/src/unit.messages.de.ts
CHANGED
package/src/unit.messages.en.ts
CHANGED