@treely/strapi-slices 5.0.0 → 5.1.1
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/dist/components/CustomerCard/CustomerCard.d.ts +6 -0
- package/dist/components/CustomerCard/index.d.ts +2 -0
- package/dist/{slices/CustomerStories → components/CustomerCard}/messages.de.d.ts +1 -1
- package/dist/{slices/CustomerStories → components/CustomerCard}/messages.en.d.ts +1 -1
- package/dist/components/CustomerQuoteCard/CustomerQuoteCard.d.ts +6 -0
- package/dist/components/CustomerQuoteCard/index.d.ts +2 -0
- package/dist/components/CustomerQuoteCard/messages.de.d.ts +4 -0
- package/dist/components/CustomerQuoteCard/messages.en.d.ts +4 -0
- package/dist/models/strapi/StrapiCustomerStory.d.ts +6 -3
- package/dist/rootMessages.de.d.ts +2 -1
- package/dist/rootMessages.en.d.ts +2 -1
- package/dist/strapi-slices.cjs.development.js +178 -109
- 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 +178 -109
- package/dist/strapi-slices.esm.js.map +1 -1
- package/dist/test/strapiMocks/strapiCustomerStory.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/CreditsAvailableBadge/messages.de.ts +1 -2
- package/src/components/CreditsAvailableBadge/messages.en.ts +1 -1
- package/src/components/CustomerCard/CustomerCard.test.tsx +49 -0
- package/src/components/CustomerCard/CustomerCard.tsx +63 -0
- package/src/components/CustomerCard/index.ts +3 -0
- package/src/{slices/CustomerStories → components/CustomerCard}/messages.de.ts +1 -1
- package/src/{slices/CustomerStories → components/CustomerCard}/messages.en.ts +1 -1
- package/src/components/CustomerQuoteCard/CustomerQuoteCard.test.tsx +57 -0
- package/src/components/CustomerQuoteCard/CustomerQuoteCard.tsx +55 -0
- package/src/components/CustomerQuoteCard/index.ts +3 -0
- package/src/components/CustomerQuoteCard/messages.de.ts +4 -0
- package/src/components/CustomerQuoteCard/messages.en.ts +4 -0
- package/src/components/portfolio/PortfolioProjectCard/messages.de.ts +1 -1
- package/src/components/portfolio/PortfolioProjectCard/messages.en.ts +1 -1
- package/src/models/strapi/StrapiCustomerStory.ts +6 -3
- package/src/rootMessages.de.ts +8 -6
- package/src/rootMessages.en.ts +8 -6
- package/src/slices/CustomerStories/CustomerStories.stories.tsx +32 -3
- package/src/slices/CustomerStories/CustomerStories.test.tsx +2 -2
- package/src/slices/CustomerStories/CustomerStories.tsx +13 -56
- package/src/test/strapiMocks/strapiCustomerStory.ts +30 -164
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import IStrapiData from '../../models/strapi/IStrapiData';
|
|
2
2
|
import StrapiCustomerStory from '../../models/strapi/StrapiCustomerStory';
|
|
3
3
|
export declare const strapiCustomerStoryMock: IStrapiData<StrapiCustomerStory>;
|
|
4
|
+
export declare const strapiCustomerStoryMock1: IStrapiData<StrapiCustomerStory>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ 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
|
-
'components.creditsAvailableBadge.text.notYet':
|
|
6
|
-
'Noch keine Credits verfügbar',
|
|
5
|
+
'components.creditsAvailableBadge.text.notYet': 'Gutschriften bald verfügbar',
|
|
7
6
|
};
|
|
8
7
|
export default messagesDe;
|
|
@@ -2,6 +2,6 @@ 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
|
-
'components.creditsAvailableBadge.text.notYet': '
|
|
5
|
+
'components.creditsAvailableBadge.text.notYet': 'Credits available soon',
|
|
6
6
|
};
|
|
7
7
|
export default messagesEn;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '../../test/testUtils';
|
|
3
|
+
import { mergeDeep } from '../../utils/mergeDeep';
|
|
4
|
+
import { strapiCustomerStoryMock } from '../../test/strapiMocks/strapiCustomerStory';
|
|
5
|
+
import { CustomerCardProps } from './CustomerCard';
|
|
6
|
+
import CustomerCard from '../CustomerCard';
|
|
7
|
+
import messagesEn from './messages.en';
|
|
8
|
+
|
|
9
|
+
const defaultProps: CustomerCardProps = {
|
|
10
|
+
customerStory: strapiCustomerStoryMock.attributes,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const setup = (props = {}) => {
|
|
14
|
+
const combinedProps = mergeDeep(defaultProps, props);
|
|
15
|
+
render(<CustomerCard {...combinedProps} />);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('The CustomerCard component', () => {
|
|
19
|
+
it('displays the customer card title', () => {
|
|
20
|
+
setup();
|
|
21
|
+
|
|
22
|
+
expect(
|
|
23
|
+
screen.getByText(strapiCustomerStoryMock.attributes.title || '')
|
|
24
|
+
).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('displays the customer card image', () => {
|
|
28
|
+
setup();
|
|
29
|
+
|
|
30
|
+
expect(screen.getByRole('img')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('displays the customer card industry', () => {
|
|
34
|
+
setup();
|
|
35
|
+
|
|
36
|
+
expect(
|
|
37
|
+
screen.getByText(
|
|
38
|
+
strapiCustomerStoryMock.attributes.customerCardCustomerIndustry || ''
|
|
39
|
+
)
|
|
40
|
+
).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('displays the button', () => {
|
|
44
|
+
setup();
|
|
45
|
+
|
|
46
|
+
expect(screen.getByRole('link')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText(messagesEn['sections.customerCard.more']));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Container,
|
|
3
|
+
Center,
|
|
4
|
+
Heading,
|
|
5
|
+
Button,
|
|
6
|
+
Link,
|
|
7
|
+
Box,
|
|
8
|
+
Text,
|
|
9
|
+
Flex,
|
|
10
|
+
} from 'boemly';
|
|
11
|
+
import React, { useContext } from 'react';
|
|
12
|
+
import { StrapiCustomerStory, strapiMediaUrl } from '../..';
|
|
13
|
+
import Image from 'next/image';
|
|
14
|
+
import { IntlContext } from '../../components/ContextProvider';
|
|
15
|
+
|
|
16
|
+
export interface CustomerCardProps {
|
|
17
|
+
customerStory: StrapiCustomerStory;
|
|
18
|
+
}
|
|
19
|
+
export const CustomerCard = ({
|
|
20
|
+
customerStory,
|
|
21
|
+
}: CustomerCardProps): JSX.Element => {
|
|
22
|
+
const { formatMessage } = useContext(IntlContext);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Container padding="none" height="full">
|
|
26
|
+
<Flex flexDir="column" height="full">
|
|
27
|
+
<Center height="24" backgroundColor="primary.50" borderTopRadius="xl">
|
|
28
|
+
{customerStory.cardImage && (
|
|
29
|
+
<Box position="relative" height="12" width="12">
|
|
30
|
+
<Image
|
|
31
|
+
src={strapiMediaUrl(customerStory.cardImage.img, 'medium')}
|
|
32
|
+
alt={customerStory.cardImage.alt}
|
|
33
|
+
fill
|
|
34
|
+
style={{
|
|
35
|
+
objectFit: customerStory.cardImage.objectFit,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
</Box>
|
|
39
|
+
)}
|
|
40
|
+
</Center>
|
|
41
|
+
<Box px="6" pt="8" pb="6" mb="auto">
|
|
42
|
+
{customerStory.customerCardCustomerIndustry && (
|
|
43
|
+
<Text size="xsMonoUppercase" color="gray.500" mb="2">
|
|
44
|
+
{customerStory.customerCardCustomerIndustry}
|
|
45
|
+
</Text>
|
|
46
|
+
)}
|
|
47
|
+
{customerStory.title && (
|
|
48
|
+
<Heading size="md" fontWeight="500">
|
|
49
|
+
{customerStory.title}
|
|
50
|
+
</Heading>
|
|
51
|
+
)}
|
|
52
|
+
</Box>
|
|
53
|
+
<Box px="6" pt="8" pb="6">
|
|
54
|
+
<Link href={`/customer-stories/${customerStory.slug}`}>
|
|
55
|
+
<Button variant="outline" size="sm">
|
|
56
|
+
{formatMessage({ id: 'sections.customerCard.more' })}
|
|
57
|
+
</Button>
|
|
58
|
+
</Link>
|
|
59
|
+
</Box>
|
|
60
|
+
</Flex>
|
|
61
|
+
</Container>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '../../test/testUtils';
|
|
3
|
+
import { mergeDeep } from '../../utils/mergeDeep';
|
|
4
|
+
import { strapiCustomerStoryMock } from '../../test/strapiMocks/strapiCustomerStory';
|
|
5
|
+
import { CustomerQuoteCardProps } from './CustomerQuoteCard';
|
|
6
|
+
import CustomerQuoteCard from '.';
|
|
7
|
+
import messagesEn from './messages.en';
|
|
8
|
+
|
|
9
|
+
const defaultProps: CustomerQuoteCardProps = {
|
|
10
|
+
customerStory: strapiCustomerStoryMock.attributes,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const setup = (props = {}) => {
|
|
14
|
+
const combinedProps = mergeDeep(defaultProps, props);
|
|
15
|
+
render(<CustomerQuoteCard {...combinedProps} />);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('The QuoteCustomerCard component', () => {
|
|
19
|
+
it('displays the customer name', () => {
|
|
20
|
+
setup();
|
|
21
|
+
|
|
22
|
+
expect(
|
|
23
|
+
screen.getByText(strapiCustomerStoryMock.attributes.customerName || '')
|
|
24
|
+
).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('displays the customer title', () => {
|
|
28
|
+
setup();
|
|
29
|
+
|
|
30
|
+
expect(
|
|
31
|
+
screen.getByText(
|
|
32
|
+
strapiCustomerStoryMock.attributes.quoteCardCustomerTitle || ''
|
|
33
|
+
)
|
|
34
|
+
).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('displays the customer quote text', () => {
|
|
38
|
+
setup();
|
|
39
|
+
|
|
40
|
+
expect(
|
|
41
|
+
screen.getByText(strapiCustomerStoryMock.attributes.quoteCardQuote || '')
|
|
42
|
+
).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('displays the customer card image', () => {
|
|
46
|
+
setup();
|
|
47
|
+
|
|
48
|
+
expect(screen.getByRole('img')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('displays the button', () => {
|
|
52
|
+
setup();
|
|
53
|
+
|
|
54
|
+
expect(screen.getByRole('link')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText(messagesEn['sections.customerQuoteCard.more']));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Container, Heading, Button, Link, Box, Text } from 'boemly';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { StrapiCustomerStory, strapiMediaUrl } from '../..';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { IntlContext } from '../../components/ContextProvider';
|
|
6
|
+
|
|
7
|
+
export interface CustomerQuoteCardProps {
|
|
8
|
+
customerStory: StrapiCustomerStory;
|
|
9
|
+
}
|
|
10
|
+
export const CustomerQuoteCard = ({
|
|
11
|
+
customerStory,
|
|
12
|
+
}: CustomerQuoteCardProps): JSX.Element => {
|
|
13
|
+
const { formatMessage } = useContext(IntlContext);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Container p="1" backgroundColor="primary.100" height="full">
|
|
17
|
+
{customerStory.cardImage ? (
|
|
18
|
+
<Box
|
|
19
|
+
position="relative"
|
|
20
|
+
height="12"
|
|
21
|
+
width="12"
|
|
22
|
+
borderRadius="full"
|
|
23
|
+
overflow="hidden"
|
|
24
|
+
>
|
|
25
|
+
<Image
|
|
26
|
+
src={strapiMediaUrl(customerStory.cardImage.img, 'medium')}
|
|
27
|
+
alt={customerStory.cardImage.alt}
|
|
28
|
+
fill
|
|
29
|
+
style={{
|
|
30
|
+
objectFit: customerStory.cardImage.objectFit,
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Box>
|
|
34
|
+
) : (
|
|
35
|
+
<></>
|
|
36
|
+
)}
|
|
37
|
+
<Box>
|
|
38
|
+
<Box my="8">
|
|
39
|
+
<Heading size="md" fontWeight="500">
|
|
40
|
+
{customerStory.customerName}
|
|
41
|
+
</Heading>
|
|
42
|
+
<Text size="xs">{customerStory.quoteCardCustomerTitle}</Text>
|
|
43
|
+
</Box>
|
|
44
|
+
<Text size="xs" color="black">
|
|
45
|
+
{customerStory.quoteCardQuote}
|
|
46
|
+
</Text>
|
|
47
|
+
<Link href={`/customer-stories/${customerStory.slug}`}>
|
|
48
|
+
<Button variant="outline" size="sm" mt="8">
|
|
49
|
+
{formatMessage({ id: 'sections.customerQuoteCard.more' })}
|
|
50
|
+
</Button>
|
|
51
|
+
</Link>
|
|
52
|
+
</Box>
|
|
53
|
+
</Container>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -2,7 +2,7 @@ const messagesDe = {
|
|
|
2
2
|
'components.portfolioProjectCard.text.yes': 'Credits verfügbar',
|
|
3
3
|
'components.portfolioProjectCard.text.some': 'Einige verbleibende Credits',
|
|
4
4
|
'components.portfolioProjectCard.text.no': 'Keine verbleibenden Credits',
|
|
5
|
-
'components.portfolioProjectCard.text.notYet': '
|
|
5
|
+
'components.portfolioProjectCard.text.notYet': 'Gutschriften bald verfügbar',
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export default messagesDe;
|
|
@@ -2,7 +2,7 @@ const messagesEn = {
|
|
|
2
2
|
'components.portfolioProjectCard.text.yes': 'Credits available',
|
|
3
3
|
'components.portfolioProjectCard.text.some': 'Some remaining credits',
|
|
4
4
|
'components.portfolioProjectCard.text.no': 'No remaining credits',
|
|
5
|
-
'components.portfolioProjectCard.text.notYet': '
|
|
5
|
+
'components.portfolioProjectCard.text.notYet': 'Credits available soon',
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export default messagesEn;
|
|
@@ -8,9 +8,11 @@ interface StrapiCustomerStory {
|
|
|
8
8
|
title: string;
|
|
9
9
|
slug: string;
|
|
10
10
|
img: StrapiImage;
|
|
11
|
-
customerName
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
customerName?: string;
|
|
12
|
+
customerCardCustomerIndustry?: string;
|
|
13
|
+
quoteCardCustomerTitle?: string;
|
|
14
|
+
cardImage?: StrapiImage;
|
|
15
|
+
quoteCardQuote?: string;
|
|
14
16
|
locale: Locale;
|
|
15
17
|
createdAt: string;
|
|
16
18
|
updatedAt: string;
|
|
@@ -18,6 +20,7 @@ interface StrapiCustomerStory {
|
|
|
18
20
|
slices: any[];
|
|
19
21
|
localizations: StrapiLocalization[];
|
|
20
22
|
topBanner?: StrapiTopBanner;
|
|
23
|
+
variant?: 'customerCard' | 'quoteCard';
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export default StrapiCustomerStory;
|
package/src/rootMessages.de.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import comparisonMessagesDe from './slices/Comparison/messages.de';
|
|
2
|
+
import creditsAvailableBadgeMessagesDe from './components/CreditsAvailableBadge/messages.de';
|
|
2
3
|
import ctaMessagesDe from './slices/Cta/messages.de';
|
|
3
|
-
import
|
|
4
|
+
import customerCardMessagesDe from './components/CustomerCard/messages.de';
|
|
5
|
+
import customerQuoteCardMessagesDe from './components/CustomerQuoteCard/messages.de';
|
|
4
6
|
import glossaryMessagesDe from './slices/Glossary/messages.de';
|
|
7
|
+
import portfolioDocumentsDownloadListMessagesDe from './components/portfolio/DocumentsDownloadList/messages.de';
|
|
5
8
|
import projectFactsMessagesDe from './slices/ProjectFacts/messages.de';
|
|
6
9
|
import projectsMapMessagesDe from './slices/ProjectsMap/messages.de';
|
|
7
|
-
import shopCheckoutMessagesDe from './slices/ShopCheckout/messages.de';
|
|
8
|
-
import creditsAvailableBadgeMessagesDe from './components/CreditsAvailableBadge/messages.de';
|
|
9
|
-
import portfolioDocumentsDownloadListMessagesDe from './components/portfolio/DocumentsDownloadList/messages.de';
|
|
10
10
|
import portfolioProjectInfoMessagesDe from './components/portfolio/ProjectInfo/messages.de';
|
|
11
|
-
import portfolioSmallCheckoutMessagesDe from './components/portfolio/SmallCheckout/messages.de';
|
|
12
11
|
import portfolioProjectCardMessagesDe from './components/portfolio/PortfolioProjectCard/messages.de';
|
|
12
|
+
import portfolioSmallCheckoutMessagesDe from './components/portfolio/SmallCheckout/messages.de';
|
|
13
|
+
import shopCheckoutMessagesDe from './slices/ShopCheckout/messages.de';
|
|
13
14
|
import timelineMessagesDe from './slices/Timeline/messages.de';
|
|
14
15
|
|
|
15
16
|
import unitMessagesDe from './unit.messages.de';
|
|
@@ -29,7 +30,8 @@ const rootMessagesDe = {
|
|
|
29
30
|
//
|
|
30
31
|
...comparisonMessagesDe,
|
|
31
32
|
...ctaMessagesDe,
|
|
32
|
-
...
|
|
33
|
+
...customerCardMessagesDe,
|
|
34
|
+
...customerQuoteCardMessagesDe,
|
|
33
35
|
...glossaryMessagesDe,
|
|
34
36
|
...projectFactsMessagesDe,
|
|
35
37
|
...projectsMapMessagesDe,
|
package/src/rootMessages.en.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import comparisonMessagesEn from './slices/Comparison/messages.en';
|
|
2
|
+
import creditsAvailableBadgeMessagesEn from './components/CreditsAvailableBadge/messages.en';
|
|
2
3
|
import ctaMessagesEn from './slices/Cta/messages.en';
|
|
3
|
-
import
|
|
4
|
+
import customerCardMessagesEn from './components/CustomerCard/messages.en';
|
|
5
|
+
import customerQuoteCardMessagesEn from './components/CustomerQuoteCard/messages.en';
|
|
4
6
|
import glossaryMessagesEn from './slices/Glossary/messages.en';
|
|
7
|
+
import portfolioDocumentsDownloadListMessagesEn from './components/portfolio/DocumentsDownloadList/messages.en';
|
|
5
8
|
import projectFactsMessagesEn from './slices/ProjectFacts/messages.en';
|
|
6
9
|
import projectsMapMessagesEn from './slices/ProjectsMap/messages.en';
|
|
7
|
-
import shopCheckoutMessagesEn from './slices/ShopCheckout/messages.en';
|
|
8
|
-
import creditsAvailableBadgeMessagesEn from './components/CreditsAvailableBadge/messages.en';
|
|
9
|
-
import portfolioDocumentsDownloadListMessagesEn from './components/portfolio/DocumentsDownloadList/messages.en';
|
|
10
10
|
import portfolioProjectInfoMessagesEn from './components/portfolio/ProjectInfo/messages.en';
|
|
11
|
-
import portfolioSmallCheckoutMessagesEn from './components/portfolio/SmallCheckout/messages.en';
|
|
12
11
|
import portfolioProjectCardMessagesEn from './components/portfolio/PortfolioProjectCard/messages.en';
|
|
12
|
+
import portfolioSmallCheckoutMessagesEn from './components/portfolio/SmallCheckout/messages.en';
|
|
13
|
+
import shopCheckoutMessagesEn from './slices/ShopCheckout/messages.en';
|
|
13
14
|
import timelineMessagesEn from './slices/Timeline/messages.en';
|
|
14
15
|
|
|
15
16
|
import unitMessagesEn from './unit.messages.en';
|
|
@@ -29,7 +30,8 @@ const rootMessagesEn = {
|
|
|
29
30
|
//
|
|
30
31
|
...comparisonMessagesEn,
|
|
31
32
|
...ctaMessagesEn,
|
|
32
|
-
...
|
|
33
|
+
...customerCardMessagesEn,
|
|
34
|
+
...customerQuoteCardMessagesEn,
|
|
33
35
|
...glossaryMessagesEn,
|
|
34
36
|
...projectFactsMessagesEn,
|
|
35
37
|
...projectsMapMessagesEn,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
strapiCustomerStoryMock,
|
|
4
|
+
strapiCustomerStoryMock1,
|
|
5
|
+
} from '../../test/strapiMocks/strapiCustomerStory';
|
|
3
6
|
import { Meta, StoryFn } from '@storybook/react';
|
|
4
7
|
import CustomerStories from '.';
|
|
5
8
|
|
|
@@ -12,10 +15,36 @@ const Template: StoryFn<typeof CustomerStories> = (args) => (
|
|
|
12
15
|
<CustomerStories {...args} />
|
|
13
16
|
);
|
|
14
17
|
|
|
15
|
-
export const
|
|
16
|
-
|
|
18
|
+
export const WithCustomerCard = Template.bind({});
|
|
19
|
+
WithCustomerCard.args = {
|
|
17
20
|
slice: {
|
|
18
21
|
customer_stories: [strapiCustomerStoryMock],
|
|
19
22
|
},
|
|
20
23
|
customerStories: [strapiCustomerStoryMock],
|
|
21
24
|
};
|
|
25
|
+
|
|
26
|
+
export const WithQuoteCard = Template.bind({});
|
|
27
|
+
WithQuoteCard.args = {
|
|
28
|
+
slice: {
|
|
29
|
+
customer_stories: [strapiCustomerStoryMock1],
|
|
30
|
+
},
|
|
31
|
+
customerStories: [strapiCustomerStoryMock1],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const WithMultipleCards = Template.bind({});
|
|
35
|
+
WithMultipleCards.args = {
|
|
36
|
+
slice: {
|
|
37
|
+
customer_stories: [
|
|
38
|
+
strapiCustomerStoryMock1,
|
|
39
|
+
strapiCustomerStoryMock,
|
|
40
|
+
strapiCustomerStoryMock,
|
|
41
|
+
strapiCustomerStoryMock1,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
customerStories: [
|
|
45
|
+
strapiCustomerStoryMock1,
|
|
46
|
+
strapiCustomerStoryMock,
|
|
47
|
+
strapiCustomerStoryMock,
|
|
48
|
+
strapiCustomerStoryMock1,
|
|
49
|
+
],
|
|
50
|
+
};
|
|
@@ -30,7 +30,7 @@ describe('The CustomerStories component', () => {
|
|
|
30
30
|
setup();
|
|
31
31
|
|
|
32
32
|
expect(
|
|
33
|
-
screen.getByText(strapiCustomerStoryMock.attributes.title)
|
|
33
|
+
screen.getByText(strapiCustomerStoryMock.attributes.title || '')
|
|
34
34
|
).toBeInTheDocument();
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ describe('The CustomerStories component', () => {
|
|
|
38
38
|
setup({ customerStories: [] });
|
|
39
39
|
|
|
40
40
|
expect(
|
|
41
|
-
screen.queryByText(strapiCustomerStoryMock.attributes.title)
|
|
41
|
+
screen.queryByText(strapiCustomerStoryMock.attributes.title || '')
|
|
42
42
|
).not.toBeInTheDocument();
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import IStrapiData from '../../models/strapi/IStrapiData';
|
|
3
3
|
import StrapiCustomerStory from '../../models/strapi/StrapiCustomerStory';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
Button,
|
|
8
|
-
Center,
|
|
9
|
-
Container,
|
|
10
|
-
DefaultSectionContainer,
|
|
11
|
-
Heading,
|
|
12
|
-
SimpleGrid,
|
|
13
|
-
Text,
|
|
14
|
-
Wrapper,
|
|
15
|
-
} from 'boemly';
|
|
16
|
-
import Image from 'next/image';
|
|
17
|
-
import Link from 'next/link';
|
|
18
|
-
import { IntlContext } from '../../components/ContextProvider';
|
|
4
|
+
import { Box, DefaultSectionContainer, SimpleGrid, Wrapper } from 'boemly';
|
|
5
|
+
import CustomerCard from '../../components/CustomerCard';
|
|
6
|
+
import CustomerQuoteCard from '../../components/CustomerQuoteCard';
|
|
19
7
|
|
|
20
8
|
export interface CustomerStoriesProps {
|
|
21
9
|
slice: {
|
|
@@ -28,12 +16,10 @@ export const CustomerStories = ({
|
|
|
28
16
|
slice,
|
|
29
17
|
customerStories,
|
|
30
18
|
}: CustomerStoriesProps): JSX.Element => {
|
|
31
|
-
const { formatMessage } = useContext(IntlContext);
|
|
32
|
-
|
|
33
19
|
return (
|
|
34
20
|
<DefaultSectionContainer>
|
|
35
21
|
<Wrapper>
|
|
36
|
-
<SimpleGrid columns={[1, null, null, 2]} spacingX={
|
|
22
|
+
<SimpleGrid columns={[1, null, null, 2, 3]} spacingX={6} spacingY={6}>
|
|
37
23
|
{slice.customer_stories.map(({ attributes }) => {
|
|
38
24
|
const customerStory: IStrapiData<StrapiCustomerStory> | undefined =
|
|
39
25
|
customerStories.find(
|
|
@@ -43,43 +29,14 @@ export const CustomerStories = ({
|
|
|
43
29
|
return null;
|
|
44
30
|
}
|
|
45
31
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
src={strapiMediaUrl(
|
|
55
|
-
customerStory.attributes.customerLogo.img,
|
|
56
|
-
'medium'
|
|
57
|
-
)}
|
|
58
|
-
alt={customerStory.attributes.customerLogo.alt}
|
|
59
|
-
fill
|
|
60
|
-
style={{
|
|
61
|
-
objectFit:
|
|
62
|
-
customerStory.attributes.customerLogo.objectFit,
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
</Box>
|
|
66
|
-
</Center>
|
|
67
|
-
<Box px="6" pt="12" pb="6">
|
|
68
|
-
<Text size="xsMonoUppercase" color="gray.500" mb="2">
|
|
69
|
-
{customerStory.attributes.customerIndustry}
|
|
70
|
-
</Text>
|
|
71
|
-
<Heading size="xl">{customerStory.attributes.title}</Heading>
|
|
72
|
-
<Button
|
|
73
|
-
as={Link}
|
|
74
|
-
href={`/customer-stories/${customerStory.attributes.slug}`}
|
|
75
|
-
variant="outline"
|
|
76
|
-
size="sm"
|
|
77
|
-
mt="12"
|
|
78
|
-
>
|
|
79
|
-
{formatMessage({ id: 'sections.customerStories.more' })}
|
|
80
|
-
</Button>
|
|
81
|
-
</Box>
|
|
82
|
-
</Container>
|
|
32
|
+
<Box key={customerStory.id}>
|
|
33
|
+
{attributes.variant === 'customerCard' && (
|
|
34
|
+
<CustomerCard customerStory={customerStory.attributes} />
|
|
35
|
+
)}
|
|
36
|
+
{attributes.variant === 'quoteCard' && (
|
|
37
|
+
<CustomerQuoteCard customerStory={customerStory.attributes} />
|
|
38
|
+
)}
|
|
39
|
+
</Box>
|
|
83
40
|
);
|
|
84
41
|
})}
|
|
85
42
|
</SimpleGrid>
|