@treely/strapi-slices 3.0.0 → 3.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treely/strapi-slices",
3
- "version": "3.0.0",
3
+ "version": "3.1.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.",
@@ -195,6 +195,7 @@ export const SliceRenderer = ({
195
195
  return (
196
196
  <ProjectsGrid
197
197
  key={`${slice.__component}-${slice.id}`}
198
+ slice={slice}
198
199
  projects={projects}
199
200
  />
200
201
  );
@@ -15,6 +15,7 @@ export const SECTIONS_WITH_BLOG_POSTS = [
15
15
  ];
16
16
  export const SECTIONS_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
17
17
  export const SECTIONS_WITH_PROJECTS = [
18
+ 'sections.projects-grid',
18
19
  'sections.projects-map',
19
20
  'sections.project-facts',
20
21
  ];
@@ -5,8 +5,12 @@ import { ProjectsGridProps } from './ProjectsGrid';
5
5
  import fpmProjectMock from '../../test/integrationMocks/fpmProjectMock';
6
6
  import { strapiMediaMock } from '../../test/strapiMocks/strapiMedia';
7
7
  import CreditsAvailableState from '../../models/CreditsAvailableState';
8
+ import { strapiProjectMock } from '../../test/strapiMocks/strapiProject';
8
9
 
9
10
  const defaultProps: ProjectsGridProps = {
11
+ slice: {
12
+ projects: { data: [strapiProjectMock] },
13
+ },
10
14
  projects: [
11
15
  {
12
16
  ...fpmProjectMock,
@@ -4,8 +4,12 @@ import Link from 'next/link';
4
4
  import { MEDIUM_TRANSITION_DURATION } from '../../constants/animations';
5
5
  import PortfolioProject from '../../models/PortfolioProject';
6
6
  import PortfolioProjectCard from '../../components/portfolio/PortfolioProjectCard';
7
+ import { IStrapi, IStrapiData, StrapiProject } from '../..';
7
8
 
8
9
  export interface ProjectsGridProps {
10
+ slice: {
11
+ projects: IStrapi<IStrapiData<StrapiProject>[]>;
12
+ };
9
13
  projects: PortfolioProject[];
10
14
  }
11
15
 
@@ -21,9 +25,15 @@ const ConditionalWrapper = ({
21
25
 
22
26
  export const ProjectsGrid: React.FC<ProjectsGridProps> = ({
23
27
  projects,
28
+ slice,
24
29
  }: ProjectsGridProps) => {
25
30
  const filteredProjects = projects.filter(
26
- (p) => p.thumbnail && p.slug && p.isPublic
31
+ (fpmProject) =>
32
+ fpmProject.thumbnail &&
33
+ slice.projects.data.some(
34
+ (strapiProject) =>
35
+ strapiProject.attributes.fpmProjectId === fpmProject.id
36
+ )
27
37
  );
28
38
 
29
39
  return (