@treely/strapi-slices 3.1.0 → 3.2.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/dist/models/strapi/StrapiProjectCard.d.ts +12 -2
- package/dist/slices/TextWithCard/TextWithCard.d.ts +2 -1
- package/dist/strapi-slices.cjs.development.js +19 -6
- 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 +19 -6
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/sectionsConfig.ts +1 -0
- package/src/models/strapi/StrapiProjectCard.ts +12 -2
- package/src/slices/ProjectsGrid/ProjectsGrid.stories.tsx +4 -0
- package/src/slices/TextWithCard/TextWithCard.stories.tsx +15 -11
- package/src/slices/TextWithCard/TextWithCard.test.tsx +17 -16
- package/src/slices/TextWithCard/TextWithCard.tsx +25 -5
- package/src/test/strapiMocks/strapiProjectCard.ts +13 -0
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import IStrapi from './IStrapi';
|
|
2
1
|
import IStrapiData from './IStrapiData';
|
|
2
|
+
import StrapiImage from './StrapiImage';
|
|
3
3
|
import StrapiProject from './StrapiProject';
|
|
4
4
|
interface StrapiProjectCard {
|
|
5
5
|
id: number;
|
|
6
|
-
|
|
6
|
+
title: string;
|
|
7
|
+
facts: {
|
|
8
|
+
id: number;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
footerTitle: string;
|
|
12
|
+
footerSubTitle: string;
|
|
13
|
+
image: StrapiImage;
|
|
14
|
+
project?: {
|
|
15
|
+
data?: IStrapiData<StrapiProject>;
|
|
16
|
+
};
|
|
7
17
|
}
|
|
8
18
|
export default StrapiProjectCard;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import StrapiLink from '../../models/strapi/StrapiLink';
|
|
3
3
|
import StrapiProjectCard from '../../models/strapi/StrapiProjectCard';
|
|
4
|
-
import PortfolioProject from '
|
|
4
|
+
import { IStrapi, IStrapiData, PortfolioProject, StrapiProject } from '../..';
|
|
5
5
|
interface TextWithCardSlice {
|
|
6
6
|
tagline?: string;
|
|
7
7
|
title: string;
|
|
@@ -12,6 +12,7 @@ interface TextWithCardSlice {
|
|
|
12
12
|
}[];
|
|
13
13
|
button?: StrapiLink;
|
|
14
14
|
card?: StrapiProjectCard;
|
|
15
|
+
project?: IStrapi<IStrapiData<StrapiProject>>;
|
|
15
16
|
cardPosition: 'left' | 'right';
|
|
16
17
|
}
|
|
17
18
|
export interface TextWithCardProps {
|
|
@@ -489,7 +489,7 @@ var EXTENDABLE_HEADER_SECTIONS = ['sections.hero', 'sections.map-hero', 'section
|
|
|
489
489
|
var DARK_THEME_HEADER_SECTIONS = ['sections.hero', 'sections.small-hero'];
|
|
490
490
|
var SECTIONS_WITH_BLOG_POSTS = ['sections.blog', 'sections.blog-cards'];
|
|
491
491
|
var SECTIONS_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
|
|
492
|
-
var SECTIONS_WITH_PROJECTS = ['sections.projects-grid', 'sections.projects-map', 'sections.project-facts'];
|
|
492
|
+
var SECTIONS_WITH_PROJECTS = ['sections.projects-grid', 'sections.projects-map', 'sections.project-facts', 'sections.text-with-card'];
|
|
493
493
|
|
|
494
494
|
var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context, global, page, blogPosts, customerStories, projects) {
|
|
495
495
|
var _page$attributes$meta, _page$attributes$meta2, _page$attributes$meta3, _global$attributes$me, _page$attributes$meta4, _page$attributes, _page$attributes$slic, _page$attributes$slic2, _page$attributes$meta5, _page$attributes$meta6, _page$attributes$meta7, _page$attributes$meta8, _ref, _page$attributes$meta9, _page$attributes$meta10, _global$attributes$me2;
|
|
@@ -2417,17 +2417,30 @@ var PortfolioProjectCard = function PortfolioProjectCard(_ref) {
|
|
|
2417
2417
|
var TextWithCard = function TextWithCard(_ref) {
|
|
2418
2418
|
var slice = _ref.slice,
|
|
2419
2419
|
projects = _ref.projects;
|
|
2420
|
-
var
|
|
2421
|
-
var _slice$
|
|
2422
|
-
return
|
|
2420
|
+
var portfolioProject = projects.find(function (p) {
|
|
2421
|
+
var _slice$project, _slice$project2;
|
|
2422
|
+
return ((_slice$project = slice.project) == null ? void 0 : _slice$project.data.attributes.fpmProjectId) && p.id === ((_slice$project2 = slice.project) == null ? void 0 : _slice$project2.data.attributes.fpmProjectId);
|
|
2423
2423
|
});
|
|
2424
2424
|
var card = React__default.default.createElement(boemly.GridItem, {
|
|
2425
2425
|
colSpan: [4, null, null, null, 2],
|
|
2426
2426
|
rowSpan: 1,
|
|
2427
2427
|
position: "relative",
|
|
2428
2428
|
"data-testid": "card-position-" + slice.cardPosition
|
|
2429
|
-
},
|
|
2430
|
-
project:
|
|
2429
|
+
}, portfolioProject && React__default.default.createElement(PortfolioProjectCard, {
|
|
2430
|
+
project: portfolioProject
|
|
2431
|
+
}), !portfolioProject && slice.card && React__default.default.createElement(boemly.ProjectCard, {
|
|
2432
|
+
facts: slice.card.facts,
|
|
2433
|
+
footerSubTitle: slice.card.footerSubTitle,
|
|
2434
|
+
footerTitle: slice.card.footerTitle,
|
|
2435
|
+
title: slice.card.title,
|
|
2436
|
+
image: React__default.default.createElement(Image__default.default, {
|
|
2437
|
+
src: strapiMediaUrl(slice.card.image.img, 'medium'),
|
|
2438
|
+
alt: slice.card.image.alt,
|
|
2439
|
+
fill: true,
|
|
2440
|
+
style: {
|
|
2441
|
+
objectFit: slice.card.image.objectFit || 'cover'
|
|
2442
|
+
}
|
|
2443
|
+
})
|
|
2431
2444
|
}));
|
|
2432
2445
|
return React__default.default.createElement(boemly.DefaultSectionContainer, {
|
|
2433
2446
|
title: slice.title
|