@treely/strapi-slices 5.16.0 → 5.17.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.
Files changed (39) hide show
  1. package/dist/components/ProjectGridCard/messages.de.d.ts +5 -0
  2. package/dist/components/ProjectGridCard/messages.en.d.ts +5 -0
  3. package/dist/models/PortfolioProject.d.ts +0 -1
  4. package/dist/models/fpm/FPMProject.d.ts +1 -0
  5. package/dist/rootMessages.de.d.ts +2 -1
  6. package/dist/rootMessages.en.d.ts +2 -1
  7. package/dist/slices/ProjectFacts/messages.de.d.ts +0 -1
  8. package/dist/slices/ProjectFacts/messages.en.d.ts +0 -1
  9. package/dist/slices/ProjectsGrid/ProjectsGrid.stories.d.ts +2 -0
  10. package/dist/strapi-slices.cjs.development.js +45 -33
  11. package/dist/strapi-slices.cjs.development.js.map +1 -1
  12. package/dist/strapi-slices.cjs.production.min.js +1 -1
  13. package/dist/strapi-slices.cjs.production.min.js.map +1 -1
  14. package/dist/strapi-slices.esm.js +47 -35
  15. package/dist/strapi-slices.esm.js.map +1 -1
  16. package/dist/utils/getMessages.d.ts +4 -2
  17. package/package.json +1 -1
  18. package/src/components/CreditsAvailableBadge/CreditsAvailableBadge.tsx +1 -4
  19. package/src/{slices → components}/ProjectGridCard/ProjectGridCard.test.tsx +6 -0
  20. package/src/{slices → components}/ProjectGridCard/ProjectGridCard.tsx +20 -2
  21. package/src/components/ProjectGridCard/messages.de.ts +6 -0
  22. package/src/components/ProjectGridCard/messages.en.ts +6 -0
  23. package/src/integrations/strapi/getPortfolioProjects.ts +0 -3
  24. package/src/models/PortfolioProject.ts +0 -1
  25. package/src/models/fpm/FPMProject.ts +1 -0
  26. package/src/rootMessages.de.ts +2 -0
  27. package/src/rootMessages.en.ts +2 -0
  28. package/src/slices/ProjectFacts/messages.de.ts +0 -1
  29. package/src/slices/ProjectFacts/messages.en.ts +0 -1
  30. package/src/slices/ProjectsGrid/ProjectsGrid.stories.tsx +34 -0
  31. package/src/slices/ProjectsGrid/ProjectsGrid.test.tsx +0 -1
  32. package/src/slices/ProjectsGrid/ProjectsGrid.tsx +1 -1
  33. package/src/slices/TextWithCard/TextWithCard.tsx +1 -1
  34. package/src/test/integrationMocks/fpmProjectMock.ts +1 -0
  35. package/dist/test/integrationMocks/fpmPortoflioProjectMock.d.ts +0 -3
  36. package/src/test/integrationMocks/fpmPortoflioProjectMock.ts +0 -16
  37. /package/dist/{slices → components}/ProjectGridCard/ProjectGridCard.d.ts +0 -0
  38. /package/dist/{slices → components}/ProjectGridCard/index.d.ts +0 -0
  39. /package/src/{slices → components}/ProjectGridCard/index.ts +0 -0
@@ -21,7 +21,6 @@ declare const getMessages: (locale: string) => {
21
21
  'sections.shopCheckout.submit': string;
22
22
  'sections.projectsMap.link.text': string;
23
23
  'sections.projectFacts.projectInfo.value': string;
24
- 'projects.projectFacts.properties.area': string;
25
24
  'sections.glossary.copyButtonLabel': string;
26
25
  'sections.glossary.copySuccessMessage': string;
27
26
  'sections.glossary.copyFailureMessage': string;
@@ -30,6 +29,8 @@ declare const getMessages: (locale: string) => {
30
29
  'sections.cta.backgroundShapesDark': string;
31
30
  'sections.cta.backgroundShapesLight': string;
32
31
  'sections.comparison.backgroundShapes': string;
32
+ 'components.projectGridCard.certified': string;
33
+ 'components.projectGridCard.certificationInProgres': string;
33
34
  'portfolio.smallCheckout.price.taxNotIncluded': string;
34
35
  'portfolio.smallCheckout.price.taxIncluded': string;
35
36
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
@@ -88,7 +89,6 @@ declare const getMessages: (locale: string) => {
88
89
  'sections.shopCheckout.submit': string;
89
90
  'sections.projectsMap.link.text': string;
90
91
  'sections.projectFacts.projectInfo.value': string;
91
- 'projects.projectFacts.properties.area': string;
92
92
  'sections.glossary.copyButtonLabel': string;
93
93
  'sections.glossary.copySuccessMessage': string;
94
94
  'sections.glossary.copyFailureMessage': string;
@@ -97,6 +97,8 @@ declare const getMessages: (locale: string) => {
97
97
  'sections.cta.backgroundShapes': string;
98
98
  'sections.cta.backgroundShapesLight': string;
99
99
  'sections.comparison.backgroundShapes': string;
100
+ 'components.projectGridCard.certified': string;
101
+ 'components.projectGridCard.certificationInProgres': string;
100
102
  'portfolio.smallCheckout.price.taxNotIncluded': string;
101
103
  'portfolio.smallCheckout.price.taxIncluded': string;
102
104
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treely/strapi-slices",
3
- "version": "5.16.0",
3
+ "version": "5.17.1",
4
4
  "license": "MIT",
5
5
  "author": "Tree.ly FlexCo",
6
6
  "description": "@treely/strapi-slices is a open source library maintained by Tree.ly.",
@@ -1,9 +1,8 @@
1
1
  import React, { useContext } from 'react';
2
- import { Flex, Spacer, Tag, Text } from 'boemly';
2
+ import { Flex, Tag, Text } from 'boemly';
3
3
  import NextLink from 'next/link';
4
4
  import { IntlContext } from '../ContextProvider';
5
5
  import { CreditAvailability } from '../../models/fpm/FPMProject';
6
- import { Info } from '@phosphor-icons/react';
7
6
 
8
7
  export interface CreditsAvailableBadgeProps {
9
8
  status: CreditAvailability;
@@ -55,8 +54,6 @@ const CreditsAvailableBadge = ({
55
54
  href={href}
56
55
  >
57
56
  <Tag backgroundColor={variant.color} mt="2" mb="1">
58
- <Info size={12} color="white" weight="fill" />
59
- <Spacer width="1" />
60
57
  <Text color="white" size="xsLowBold">
61
58
  {variant.message}
62
59
  </Text>
@@ -44,6 +44,12 @@ describe('The ProjectGridCard component', () => {
44
44
  expect(screen.getByText('Austria')).toBeInTheDocument();
45
45
  });
46
46
 
47
+ it('displays the certification date if it is defined', () => {
48
+ setup();
49
+
50
+ expect(screen.getByText('Certified, 2020')).toBeInTheDocument();
51
+ });
52
+
47
53
  it('displays the credits available badge', () => {
48
54
  setup();
49
55
 
@@ -3,9 +3,9 @@ import React, { useContext } from 'react';
3
3
  import Image from 'next/image';
4
4
  import PortfolioProject from '../../models/PortfolioProject';
5
5
  import { strapiMediaUrl } from '../..';
6
- import { IntlContext } from 'react-intl';
7
6
  import { FORMAT_AS_HECTARE_CONFIG } from '../../constants/formatter';
8
7
  import CreditsAvailableBadge from '../../components/CreditsAvailableBadge';
8
+ import { IntlContext } from '../ContextProvider';
9
9
 
10
10
  export interface ProjectGridCardProps {
11
11
  project: PortfolioProject;
@@ -14,7 +14,7 @@ export interface ProjectGridCardProps {
14
14
  export const ProjectGridCard = ({
15
15
  project,
16
16
  }: ProjectGridCardProps): JSX.Element => {
17
- const { formatNumber } = useContext(IntlContext);
17
+ const { formatNumber, formatMessage } = useContext(IntlContext);
18
18
 
19
19
  return (
20
20
  <Container>
@@ -49,6 +49,24 @@ export const ProjectGridCard = ({
49
49
  {project.location}
50
50
  </Text>
51
51
  </Tag>
52
+ {project.certificationDate ? (
53
+ <Tag>
54
+ <Text size="xsLowBold" color="gray.800">
55
+ {formatMessage(
56
+ { id: 'components.projectGridCard.certified' },
57
+ { year: new Date(project.certificationDate).getFullYear() }
58
+ )}
59
+ </Text>
60
+ </Tag>
61
+ ) : (
62
+ <Tag>
63
+ <Text size="xsLowBold" color="gray.800">
64
+ {formatMessage({
65
+ id: 'components.projectGridCard.certificationInProgress',
66
+ })}
67
+ </Text>
68
+ </Tag>
69
+ )}
52
70
  </Flex>
53
71
  <CreditsAvailableBadge status={project.creditAvailability} />
54
72
  </Flex>
@@ -0,0 +1,6 @@
1
+ const messagesDe = {
2
+ 'components.projectGridCard.certified': 'Zertifiziert, {year}',
3
+ 'components.projectGridCard.certificationInProgres':
4
+ 'Zertifizierung ist in Arbeit',
5
+ };
6
+ export default messagesDe;
@@ -0,0 +1,6 @@
1
+ const messagesDe = {
2
+ 'components.projectGridCard.certified': 'Certified, {year}',
3
+ 'components.projectGridCard.certificationInProgres':
4
+ 'Certification in progress',
5
+ };
6
+ export default messagesDe;
@@ -67,9 +67,6 @@ const getPortfolioProjects = async (
67
67
  if (strapiProject?.attributes.thumbnail) {
68
68
  toReturn.thumbnail = strapiProject?.attributes.thumbnail;
69
69
  }
70
- if (strapiProject?.attributes.footerSubTitle) {
71
- toReturn.footerSubTitle = strapiProject?.attributes.footerSubTitle;
72
- }
73
70
  if (strapiProject?.attributes.portfolio.data?.attributes.host) {
74
71
  toReturn.portfolioHost =
75
72
  strapiProject.attributes.portfolio.data.attributes.host;
@@ -6,7 +6,6 @@ interface PortfolioProject extends FPMProject {
6
6
  slug?: string;
7
7
  portfolioHost?: string;
8
8
  thumbnail?: StrapiImage | null;
9
- footerSubTitle?: string;
10
9
  }
11
10
 
12
11
  export default PortfolioProject;
@@ -41,6 +41,7 @@ interface FPMProject {
41
41
  riskBuffer?: number;
42
42
  defaultIssuer?: Issuer;
43
43
  creditAvailability: CreditAvailability;
44
+ certificationDate?: Date;
44
45
 
45
46
  createdAt: Date;
46
47
  updatedAt: Date;
@@ -6,6 +6,7 @@ import customerQuoteCardMessagesDe from './components/CustomerQuoteCard/messages
6
6
  import glossaryMessagesDe from './slices/Glossary/messages.de';
7
7
  import portfolioDocumentsDownloadListMessagesDe from './components/portfolio/DocumentsDownloadList/messages.de';
8
8
  import projectFactsMessagesDe from './slices/ProjectFacts/messages.de';
9
+ import projectGridCardMessagesDe from './components/ProjectGridCard/messages.de';
9
10
  import projectsMapMessagesDe from './slices/ProjectsMap/messages.de';
10
11
  import portfolioProjectInfoMessagesDe from './components/portfolio/ProjectInfo/messages.de';
11
12
  import portfolioSmallCheckoutMessagesDe from './components/portfolio/SmallCheckout/messages.de';
@@ -23,6 +24,7 @@ const rootMessagesDe = {
23
24
  ...portfolioDocumentsDownloadListMessagesDe,
24
25
  ...portfolioProjectInfoMessagesDe,
25
26
  ...portfolioSmallCheckoutMessagesDe,
27
+ ...projectGridCardMessagesDe,
26
28
 
27
29
  //
28
30
  // Slices
@@ -6,6 +6,7 @@ import customerQuoteCardMessagesEn from './components/CustomerQuoteCard/messages
6
6
  import glossaryMessagesEn from './slices/Glossary/messages.en';
7
7
  import portfolioDocumentsDownloadListMessagesEn from './components/portfolio/DocumentsDownloadList/messages.en';
8
8
  import projectFactsMessagesEn from './slices/ProjectFacts/messages.en';
9
+ import projectGridCardMessagesEn from './components/ProjectGridCard/messages.en';
9
10
  import projectsMapMessagesEn from './slices/ProjectsMap/messages.en';
10
11
  import portfolioProjectInfoMessagesEn from './components/portfolio/ProjectInfo/messages.en';
11
12
  import portfolioSmallCheckoutMessagesEn from './components/portfolio/SmallCheckout/messages.en';
@@ -23,6 +24,7 @@ const rootMessagesEn = {
23
24
  ...portfolioDocumentsDownloadListMessagesEn,
24
25
  ...portfolioProjectInfoMessagesEn,
25
26
  ...portfolioSmallCheckoutMessagesEn,
27
+ ...projectGridCardMessagesEn,
26
28
 
27
29
  //
28
30
  // Slices
@@ -1,5 +1,4 @@
1
1
  const messagesDe = {
2
2
  'sections.projectFacts.projectInfo.value': 'Projekt Infos',
3
- 'projects.projectFacts.properties.area': 'Fläche',
4
3
  };
5
4
  export default messagesDe;
@@ -1,5 +1,4 @@
1
1
  const messagesEn = {
2
2
  'sections.projectFacts.projectInfo.value': 'Project Infos',
3
- 'projects.projectFacts.properties.area': 'Area',
4
3
  };
5
4
  export default messagesEn;
@@ -4,6 +4,7 @@ import { StoryFn, Meta } from '@storybook/react';
4
4
  import ProjectsGrid from '.';
5
5
  import { strapiProjectMock } from '../../test/strapiMocks/strapiProject';
6
6
  import portfolioProjectMock from '../../test/integrationMocks/portfolioProjectMock';
7
+ import { CreditAvailability } from '../../models/fpm/FPMProject';
7
8
 
8
9
  export default {
9
10
  title: 'slices/ProjectsGrid',
@@ -21,3 +22,36 @@ Minimal.args = {
21
22
  projects: { data: [strapiProjectMock] },
22
23
  },
23
24
  };
25
+
26
+ export const WithoutCertificationDate = Template.bind({});
27
+ WithoutCertificationDate.args = {
28
+ projects: [{ ...portfolioProjectMock, certificationDate: undefined }],
29
+ slice: {
30
+ projects: { data: [strapiProjectMock] },
31
+ },
32
+ };
33
+
34
+ export const WithCreditsAvailabilityVariants = Template.bind({});
35
+ WithCreditsAvailabilityVariants.args = {
36
+ projects: [
37
+ portfolioProjectMock,
38
+ {
39
+ ...portfolioProjectMock,
40
+ title: 'Project 2',
41
+ creditAvailability: CreditAvailability.SOME_CREDITS_AVAILABLE,
42
+ },
43
+ {
44
+ ...portfolioProjectMock,
45
+ title: 'Project 3',
46
+ creditAvailability: CreditAvailability.SOON_CREDITS_AVAILABLE,
47
+ },
48
+ {
49
+ ...portfolioProjectMock,
50
+ title: 'Project 4',
51
+ creditAvailability: CreditAvailability.NO_CREDITS_AVAILABLE,
52
+ },
53
+ ],
54
+ slice: {
55
+ projects: { data: [strapiProjectMock] },
56
+ },
57
+ };
@@ -16,7 +16,6 @@ const defaultProps: ProjectsGridProps = {
16
16
  slug: 'slug',
17
17
  isPublic: true,
18
18
  thumbnail: { img: { data: strapiMediaMock }, alt: 'Alt Text', id: 1 },
19
- footerSubTitle: 'certified-123',
20
19
  },
21
20
  ],
22
21
  };
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { Box, DefaultSectionContainer, SimpleGrid, Wrapper } from 'boemly';
3
3
  import Link from 'next/link';
4
4
  import { MEDIUM_TRANSITION_DURATION } from '../../constants/animations';
5
- import ProjectGridCard from '../ProjectGridCard';
6
5
  import PortfolioProject from '../../models/PortfolioProject';
7
6
  import IStrapi from '../../models/strapi/IStrapi';
8
7
  import IStrapiData from '../../models/strapi/IStrapiData';
9
8
  import StrapiProject from '../../models/strapi/StrapiProject';
9
+ import ProjectGridCard from '../../components/ProjectGridCard';
10
10
 
11
11
  export interface ProjectsGridProps {
12
12
  slice: {
@@ -16,7 +16,7 @@ import StrapiLink from '../../models/strapi/StrapiLink';
16
16
  import StrapiProjectCard from '../../models/strapi/StrapiProjectCard';
17
17
  import StrapiLinkButton from '../../components/StrapiLinkButton';
18
18
  import { IStrapiData, PortfolioProject, StrapiProject } from '../..';
19
- import ProjectGridCard from '../ProjectGridCard';
19
+ import ProjectGridCard from '../../components/ProjectGridCard';
20
20
 
21
21
  interface TextWithCardSlice {
22
22
  tagline?: string;
@@ -33,6 +33,7 @@ const fpmProjectMock: FPMProject = {
33
33
  createdAt: new Date('2020-01-01'),
34
34
  updatedAt: new Date('2020-01-01'),
35
35
  creditAvailability: CreditAvailability.CREDITS_AVAILABLE,
36
+ certificationDate: new Date('2020-02-02'),
36
37
  };
37
38
 
38
39
  export default fpmProjectMock;
@@ -1,3 +0,0 @@
1
- import { PortfolioProject } from '../..';
2
- declare const fpmPortfolioProjectMock: PortfolioProject;
3
- export default fpmPortfolioProjectMock;
@@ -1,16 +0,0 @@
1
- import { PortfolioProject } from '../..';
2
- import fpmProjectMock from './fpmProjectMock';
3
- import { storybookStrapiCoverMock } from '../storybookMocks/storybookStrapiMedia';
4
-
5
- const fpmPortfolioProjectMock: PortfolioProject = {
6
- ...fpmProjectMock,
7
- isPublic: true,
8
- footerSubTitle: 'Certified, 2023',
9
- thumbnail: {
10
- id: 1,
11
- img: { data: storybookStrapiCoverMock },
12
- alt: 'Project Thumbnail',
13
- },
14
- };
15
-
16
- export default fpmPortfolioProjectMock;