@blaze-cms/react-page-builder 0.140.3 → 0.141.0-alpha.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/CHANGELOG.md +38 -0
- package/README.md +23 -0
- package/lib/components/BlazeLink.js +6 -2
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js +10 -8
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/Image/ImageRender.js +4 -2
- package/lib/components/Image/ImageRender.js.map +1 -1
- package/lib/components/List/ListRender.js +10 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Header/ListHeader.js +5 -2
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/Classic.js +2 -2
- package/lib/components/List/components/Pagination/Classic.js.map +1 -1
- package/lib/components/List/components/Pagination/LoadMore.js +2 -1
- package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-items.js +2 -1
- package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
- package/lib/components/List/helpers/build-query-booster.js +57 -0
- package/lib/components/List/helpers/build-query-booster.js.map +1 -0
- package/lib/components/List/helpers/index.js +7 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/Menu/Menu.js +6 -6
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js +2 -1
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +1 -0
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SocialFollow/SFItem.js +4 -3
- package/lib/components/SocialFollow/SFItem.js.map +1 -1
- package/lib/components/Video/providers/Default.js +13 -7
- package/lib/components/Video/providers/Default.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js +5 -0
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/hooks/helpers/getVariant.js.map +1 -1
- package/lib/hooks/index.js +7 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-app-sync-event-hook.js +31 -0
- package/lib/hooks/use-app-sync-event-hook.js.map +1 -0
- package/lib/utils/variant-handler.js +2 -1
- package/lib/utils/variant-handler.js.map +1 -1
- package/lib/variants/HeroImage/index.js +29 -0
- package/lib/variants/HeroImage/index.js.map +1 -0
- package/lib/variants/Infographic/Infographic.js +27 -0
- package/lib/variants/Infographic/Infographic.js.map +1 -0
- package/lib/variants/Infographic/index.js +41 -0
- package/lib/variants/Infographic/index.js.map +1 -0
- package/lib/variants/Infographic/useInfographic.js +43 -0
- package/lib/variants/Infographic/useInfographic.js.map +1 -0
- package/lib/variants/LongformGallery/LongformGallery.js +53 -0
- package/lib/variants/LongformGallery/LongformGallery.js.map +1 -0
- package/lib/variants/LongformGallery/LongformGalleryImage.js +71 -0
- package/lib/variants/LongformGallery/LongformGalleryImage.js.map +1 -0
- package/lib/variants/LongformGallery/constants.js +19 -0
- package/lib/variants/LongformGallery/constants.js.map +1 -0
- package/lib/variants/LongformGallery/helpers/index.js +29 -0
- package/lib/variants/LongformGallery/helpers/index.js.map +1 -0
- package/lib/variants/LongformGallery/helpers/parseImageData.js +42 -0
- package/lib/variants/LongformGallery/helpers/parseImageData.js.map +1 -0
- package/lib/variants/LongformGallery/helpers/separateImages.js +36 -0
- package/lib/variants/LongformGallery/helpers/separateImages.js.map +1 -0
- package/lib/variants/LongformGallery/helpers/shouldSkip.js +13 -0
- package/lib/variants/LongformGallery/helpers/shouldSkip.js.map +1 -0
- package/lib/variants/LongformGallery/index.js +43 -0
- package/lib/variants/LongformGallery/index.js.map +1 -0
- package/lib/variants/LongformGallery/useLongformGallery.js +58 -0
- package/lib/variants/LongformGallery/useLongformGallery.js.map +1 -0
- package/lib/variants/LongformRow/index.js +29 -0
- package/lib/variants/LongformRow/index.js.map +1 -0
- package/lib/variants/ParallaxImageTextRight/index.js +30 -0
- package/lib/variants/ParallaxImageTextRight/index.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js +63 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js +37 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/index.js +11 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/index.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/useThumbnailImage.js +69 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/useThumbnailImage.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/index.js +41 -0
- package/lib/variants/ThumbnailCarousel/index.js.map +1 -0
- package/lib/variants/ThumbnailCarousel/useThumbnailCarousel.js +66 -0
- package/lib/variants/ThumbnailCarousel/useThumbnailCarousel.js.map +1 -0
- package/lib/variants/index.js +15 -1
- package/lib/variants/index.js.map +1 -1
- package/lib-es/components/BlazeLink.js +6 -2
- package/lib-es/components/BlazeLink.js.map +1 -1
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupTabs.js +10 -8
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib-es/components/Image/ImageRender.js +4 -2
- package/lib-es/components/Image/ImageRender.js.map +1 -1
- package/lib-es/components/List/ListRender.js +11 -1
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/List/components/Header/ListHeader.js +5 -2
- package/lib-es/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib-es/components/List/components/Pagination/Classic.js +2 -2
- package/lib-es/components/List/components/Pagination/Classic.js.map +1 -1
- package/lib-es/components/List/components/Pagination/LoadMore.js +2 -1
- package/lib-es/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib-es/components/List/helpers/build-pagination-items.js +2 -1
- package/lib-es/components/List/helpers/build-pagination-items.js.map +1 -1
- package/lib-es/components/List/helpers/build-query-booster.js +41 -0
- package/lib-es/components/List/helpers/build-query-booster.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +6 -6
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItem.js +2 -1
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +1 -0
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +1 -0
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SocialFollow/SFItem.js +4 -3
- package/lib-es/components/SocialFollow/SFItem.js.map +1 -1
- package/lib-es/components/Video/providers/Default.js +14 -7
- package/lib-es/components/Video/providers/Default.js.map +1 -1
- package/lib-es/components/Video/providers/get-provider.js +2 -1
- package/lib-es/components/Video/providers/get-provider.js.map +1 -1
- package/lib-es/hooks/helpers/getVariant.js.map +1 -1
- package/lib-es/hooks/index.js +1 -0
- package/lib-es/hooks/index.js.map +1 -1
- package/lib-es/hooks/use-app-sync-event-hook.js +25 -0
- package/lib-es/hooks/use-app-sync-event-hook.js.map +1 -0
- package/lib-es/utils/variant-handler.js +2 -1
- package/lib-es/utils/variant-handler.js.map +1 -1
- package/lib-es/variants/HeroImage/index.js +10 -0
- package/lib-es/variants/HeroImage/index.js.map +1 -0
- package/lib-es/variants/Infographic/Infographic.js +20 -0
- package/lib-es/variants/Infographic/Infographic.js.map +1 -0
- package/lib-es/variants/Infographic/index.js +10 -0
- package/lib-es/variants/Infographic/index.js.map +1 -0
- package/lib-es/variants/Infographic/useInfographic.js +23 -0
- package/lib-es/variants/Infographic/useInfographic.js.map +1 -0
- package/lib-es/variants/LongformGallery/LongformGallery.js +40 -0
- package/lib-es/variants/LongformGallery/LongformGallery.js.map +1 -0
- package/lib-es/variants/LongformGallery/LongformGalleryImage.js +59 -0
- package/lib-es/variants/LongformGallery/LongformGalleryImage.js.map +1 -0
- package/lib-es/variants/LongformGallery/constants.js +18 -0
- package/lib-es/variants/LongformGallery/constants.js.map +1 -0
- package/lib-es/variants/LongformGallery/helpers/index.js +5 -0
- package/lib-es/variants/LongformGallery/helpers/index.js.map +1 -0
- package/lib-es/variants/LongformGallery/helpers/parseImageData.js +26 -0
- package/lib-es/variants/LongformGallery/helpers/parseImageData.js.map +1 -0
- package/lib-es/variants/LongformGallery/helpers/separateImages.js +25 -0
- package/lib-es/variants/LongformGallery/helpers/separateImages.js.map +1 -0
- package/lib-es/variants/LongformGallery/helpers/shouldSkip.js +3 -0
- package/lib-es/variants/LongformGallery/helpers/shouldSkip.js.map +1 -0
- package/lib-es/variants/LongformGallery/index.js +12 -0
- package/lib-es/variants/LongformGallery/index.js.map +1 -0
- package/lib-es/variants/LongformGallery/useLongformGallery.js +47 -0
- package/lib-es/variants/LongformGallery/useLongformGallery.js.map +1 -0
- package/lib-es/variants/LongformRow/index.js +10 -0
- package/lib-es/variants/LongformRow/index.js.map +1 -0
- package/lib-es/variants/ParallaxImageTextRight/index.js +11 -0
- package/lib-es/variants/ParallaxImageTextRight/index.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailCarousel.js +49 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailCarousel.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js +30 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/index.js +3 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/index.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/useThumbnailImage.js +62 -0
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/useThumbnailImage.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/index.js +10 -0
- package/lib-es/variants/ThumbnailCarousel/index.js.map +1 -0
- package/lib-es/variants/ThumbnailCarousel/useThumbnailCarousel.js +47 -0
- package/lib-es/variants/ThumbnailCarousel/useThumbnailCarousel.js.map +1 -0
- package/lib-es/variants/index.js +14 -1
- package/lib-es/variants/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/BlazeLink.js +23 -4
- package/src/components/Card/Card.js +0 -1
- package/src/components/ContentGroup/ContentGroupTabs.js +11 -8
- package/src/components/Image/ImageRender.js +4 -2
- package/src/components/List/ListRender.js +11 -1
- package/src/components/List/components/Header/ListHeader.js +7 -4
- package/src/components/List/components/Pagination/Classic.js +2 -2
- package/src/components/List/components/Pagination/LoadMore.js +7 -2
- package/src/components/List/helpers/build-pagination-items.js +2 -1
- package/src/components/List/helpers/build-query-booster.js +35 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/components/Menu/Menu.js +6 -7
- package/src/components/MenuItem/MenuItem.js +5 -2
- package/src/components/SearchFilter/components/Select.js +1 -0
- package/src/components/SearchFilterSort/SearchFilterSort.js +1 -0
- package/src/components/SocialFollow/SFItem.js +8 -2
- package/src/components/Video/providers/Default.js +12 -6
- package/src/components/Video/providers/get-provider.js +2 -1
- package/src/hooks/helpers/getVariant.js +1 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/use-app-sync-event-hook.js +19 -0
- package/src/utils/variant-handler.js +2 -1
- package/src/variants/HeroImage/index.js +8 -0
- package/src/variants/Infographic/Infographic.js +14 -0
- package/src/variants/Infographic/index.js +12 -0
- package/src/variants/Infographic/useInfographic.js +18 -0
- package/src/variants/LongformGallery/LongformGallery.js +47 -0
- package/src/variants/LongformGallery/LongformGalleryImage.js +65 -0
- package/src/variants/LongformGallery/constants.js +21 -0
- package/src/variants/LongformGallery/helpers/index.js +5 -0
- package/src/variants/LongformGallery/helpers/parseImageData.js +25 -0
- package/src/variants/LongformGallery/helpers/separateImages.js +38 -0
- package/src/variants/LongformGallery/helpers/shouldSkip.js +3 -0
- package/src/variants/LongformGallery/index.js +13 -0
- package/src/variants/LongformGallery/useLongformGallery.js +41 -0
- package/src/variants/LongformRow/index.js +8 -0
- package/src/variants/ParallaxImageTextRight/index.js +9 -0
- package/src/variants/ThumbnailCarousel/ThumbnailCarousel.js +51 -0
- package/src/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js +26 -0
- package/src/variants/ThumbnailCarousel/ThumbnailImage/index.js +3 -0
- package/src/variants/ThumbnailCarousel/ThumbnailImage/useThumbnailImage.js +61 -0
- package/src/variants/ThumbnailCarousel/index.js +12 -0
- package/src/variants/ThumbnailCarousel/useThumbnailCarousel.js +42 -0
- package/src/variants/index.js +15 -1
- package/tests/unit/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.js.snap +3 -0
- package/tests/unit/src/components/Button.test.js +2 -2
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +13 -0
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +8 -0
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +2 -0
- package/tests/unit/src/components/Image/GlobalLightbox/__snapshots__/GlobalLightbox.test.js.snap +1 -0
- package/tests/unit/src/components/Image/__snapshots__/Image.test.js.snap +3 -0
- package/tests/unit/src/components/Image/__snapshots__/ImageFactory.test.js.snap +4 -0
- package/tests/unit/src/components/List/ListRender.test.js +9 -0
- package/tests/unit/src/components/List/components/Header/__snapshots__/ListHeader.test.js.snap +5 -0
- package/tests/unit/src/components/List/components/Pagination/__snapshots__/Classic.test.js.snap +8 -2
- package/tests/unit/src/components/List/components/Pagination/__snapshots__/ListPagination.test.js.snap +5 -1
- package/tests/unit/src/components/List/components/Pagination/__snapshots__/LoadMore.test.js.snap +1 -1
- package/tests/unit/src/components/List/helpers/__snapshots__/build-pagination-items.test.js.snap +21 -0
- package/tests/unit/src/components/List/helpers/build-query-booster.test.js +33 -0
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +3 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +3 -1
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +5 -3
- package/tests/unit/src/components/SearchFilterSort/__snapshots__/SearchFilterSort.test.js.snap +2 -1
- package/tests/unit/src/components/SocialFollow/__snapshots__/SFItem.test.js.snap +2 -2
- package/tests/unit/src/components/SocialFollow/__snapshots__/SocialFollow.test.js.snap +2 -6
- package/tests/unit/src/components/TextBlock/__snapshots__/TextBlock.test.js.snap +4 -0
- package/tests/unit/src/components/Video/providers/__snapshots__/Default.test.js.snap +111 -108
- package/tests/unit/src/components/__snapshots__/BlazeLink.test.js.snap +1 -1
- package/tests/unit/src/components/__snapshots__/Button.test.js.snap +1 -0
- package/tests/unit/src/helpers/__snapshots__/parse-textBlock.test.js.snap +1 -0
- package/tests/unit/src/helpers/parse-textBlock.test.js +3 -1
- package/tests/unit/src/hooks/use-app-sync-evet-hook.test.js +50 -0
- package/tests/unit/src/utils/variant-handler.test.js +9 -4
- package/tests/unit/src/variants/LongFormGallery/LongformGallery.test.js +42 -0
- package/tests/unit/src/variants/LongFormGallery/LongformGalleryImage.test.js +44 -0
- package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGallery.test.js.snap +99 -0
- package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGalleryImage.test.js.snap +51 -0
- package/tests/unit/src/variants/LongFormGallery/constants.js +37 -0
- package/tests/unit/src/variants/LongFormGallery/helpers/parseImageData.test.js +53 -0
- package/tests/unit/src/variants/LongFormGallery/helpers/separateImages.test.js +52 -0
- package/tests/unit/src/variants/LongFormGallery/helpers/shouldSkip.test.js +23 -0
- package/tests/unit/src/variants/LongFormGallery/useLongformGallery.test.js +36 -0
- package/tests/unit/src/variants/ThumbnailCarousel/ThumbnailCarousel.test.js +29 -0
- package/tests/unit/src/variants/ThumbnailCarousel/ThumbnailImage.test.js +45 -0
- package/tests/unit/src/variants/ThumbnailCarousel/__snapshots__/ThumbnailCarousel.test.js.snap +71 -0
- package/tests/unit/src/variants/ThumbnailCarousel/__snapshots__/ThumbnailImage.test.js.snap +19 -0
- package/tests/unit/src/variants/ThumbnailCarousel/mocks.js +64 -0
|
@@ -3,14 +3,31 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Link, MainContext } from '@blaze-cms/nextjs-components';
|
|
4
4
|
import buildLinkExtraProps from '../helpers/build-link-extra-props';
|
|
5
5
|
|
|
6
|
-
const BlazeLink = ({
|
|
6
|
+
const BlazeLink = ({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
name,
|
|
10
|
+
ariaLabel,
|
|
11
|
+
href,
|
|
12
|
+
as,
|
|
13
|
+
shallow,
|
|
14
|
+
scroll,
|
|
15
|
+
gtmId,
|
|
16
|
+
onClick
|
|
17
|
+
}) => {
|
|
7
18
|
const { hasGTM } = useContext(MainContext);
|
|
8
19
|
const gtmProps = hasGTM && !!gtmId ? { gtmId } : {};
|
|
9
20
|
const linkExtraProps = buildLinkExtraProps({ className, name, as, ...gtmProps });
|
|
10
21
|
if (!href) return children;
|
|
11
22
|
|
|
12
23
|
return (
|
|
13
|
-
<Link
|
|
24
|
+
<Link
|
|
25
|
+
href={href}
|
|
26
|
+
ariaLabel={ariaLabel}
|
|
27
|
+
shallow={shallow}
|
|
28
|
+
scroll={scroll}
|
|
29
|
+
onClick={onClick}
|
|
30
|
+
{...linkExtraProps}>
|
|
14
31
|
{children}
|
|
15
32
|
</Link>
|
|
16
33
|
);
|
|
@@ -26,7 +43,8 @@ BlazeLink.propTypes = {
|
|
|
26
43
|
shallow: PropTypes.bool,
|
|
27
44
|
scroll: PropTypes.bool,
|
|
28
45
|
gtmId: PropTypes.string,
|
|
29
|
-
onClick: PropTypes.func
|
|
46
|
+
onClick: PropTypes.func,
|
|
47
|
+
ariaLabel: PropTypes.string
|
|
30
48
|
};
|
|
31
49
|
|
|
32
50
|
BlazeLink.defaultProps = {
|
|
@@ -39,7 +57,8 @@ BlazeLink.defaultProps = {
|
|
|
39
57
|
shallow: false,
|
|
40
58
|
scroll: null,
|
|
41
59
|
gtmId: '',
|
|
42
|
-
onClick: null
|
|
60
|
+
onClick: null,
|
|
61
|
+
ariaLabel: ''
|
|
43
62
|
};
|
|
44
63
|
|
|
45
64
|
export default BlazeLink;
|
|
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router';
|
|
|
4
4
|
import { getActiveTab } from './helpers';
|
|
5
5
|
import { TAB, TABS, SIDEPANEL, CONTENT_GROUP, PANEL } from './constants';
|
|
6
6
|
|
|
7
|
-
const ContentGroupTabs = ({ name, contentType,
|
|
7
|
+
const ContentGroupTabs = ({ name, contentType, groupSections, sectionsData, VariantComponent }) => {
|
|
8
8
|
const router = useRouter();
|
|
9
9
|
const [selectedTab, setSelectedTab] = useState(getActiveTab(sectionsData, ''));
|
|
10
10
|
const { asPath } = router;
|
|
@@ -21,10 +21,12 @@ const ContentGroupTabs = ({ name, contentType, modifier, groupSections, sections
|
|
|
21
21
|
[asPath, sectionsData, selectedTab]
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
+
const WrapperComponent = VariantComponent || 'div';
|
|
25
|
+
|
|
24
26
|
return (
|
|
25
27
|
<div className={mainDivClass}>
|
|
26
28
|
<ul className={contentGroupClass} role="tablist" aria-label={name}>
|
|
27
|
-
{groupSections.map((
|
|
29
|
+
{groupSections.map((_, index) => {
|
|
28
30
|
const [sectionName, sectioLabel] = sectionsData[index];
|
|
29
31
|
const tabId = `${TAB}-${sectionName}`;
|
|
30
32
|
const panelId = `${PANEL}-${sectionName}`;
|
|
@@ -61,14 +63,15 @@ const ContentGroupTabs = ({ name, contentType, modifier, groupSections, sections
|
|
|
61
63
|
if (selectedTab !== tabId) return null;
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
|
-
<
|
|
65
|
-
id={sectionName}
|
|
66
|
+
<WrapperComponent
|
|
66
67
|
key={panelId}
|
|
68
|
+
id={sectionName}
|
|
67
69
|
className={sectionClass}
|
|
68
70
|
role="tabpanel"
|
|
71
|
+
tabId={tabId}
|
|
69
72
|
aria-labelledby={tabId}>
|
|
70
73
|
{groupSection}
|
|
71
|
-
</
|
|
74
|
+
</WrapperComponent>
|
|
72
75
|
);
|
|
73
76
|
})}
|
|
74
77
|
</div>
|
|
@@ -78,13 +81,13 @@ const ContentGroupTabs = ({ name, contentType, modifier, groupSections, sections
|
|
|
78
81
|
ContentGroupTabs.propTypes = {
|
|
79
82
|
name: PropTypes.string.isRequired,
|
|
80
83
|
contentType: PropTypes.string.isRequired,
|
|
81
|
-
modifier: PropTypes.string,
|
|
82
84
|
groupSections: PropTypes.array.isRequired,
|
|
83
|
-
sectionsData: PropTypes.array.isRequired
|
|
85
|
+
sectionsData: PropTypes.array.isRequired,
|
|
86
|
+
VariantComponent: PropTypes.func
|
|
84
87
|
};
|
|
85
88
|
|
|
86
89
|
ContentGroupTabs.defaultProps = {
|
|
87
|
-
|
|
90
|
+
VariantComponent: null
|
|
88
91
|
};
|
|
89
92
|
|
|
90
93
|
export default ContentGroupTabs;
|
|
@@ -72,7 +72,8 @@ ImageRender.propTypes = {
|
|
|
72
72
|
style: PropTypes.object,
|
|
73
73
|
isHero: PropTypes.bool,
|
|
74
74
|
priority: PropTypes.bool,
|
|
75
|
-
sizeKey: PropTypes.string
|
|
75
|
+
sizeKey: PropTypes.string,
|
|
76
|
+
shouldRenderImgTag: PropTypes.bool
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
ImageRender.defaultProps = {
|
|
@@ -84,7 +85,8 @@ ImageRender.defaultProps = {
|
|
|
84
85
|
isHero: false,
|
|
85
86
|
priority: false,
|
|
86
87
|
style: {},
|
|
87
|
-
sizeKey: ''
|
|
88
|
+
sizeKey: '',
|
|
89
|
+
shouldRenderImgTag: false
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
export default ImageRender;
|
|
@@ -5,6 +5,8 @@ import ListPagination from './components/Pagination';
|
|
|
5
5
|
import ListHeader from './components/Header';
|
|
6
6
|
import { sortResponseData } from '../../helpers';
|
|
7
7
|
import { LOAD_MORE } from '../../constants';
|
|
8
|
+
import { useAppSyncEventHook } from '../../hooks';
|
|
9
|
+
import { buildQueryBooster } from './helpers';
|
|
8
10
|
|
|
9
11
|
const ListRender = props => {
|
|
10
12
|
const {
|
|
@@ -27,9 +29,17 @@ const ListRender = props => {
|
|
|
27
29
|
azFilter,
|
|
28
30
|
displayTotal
|
|
29
31
|
} = props;
|
|
32
|
+
const { data: updatedVariables } = useAppSyncEventHook({
|
|
33
|
+
eventName: 'list:query-variables',
|
|
34
|
+
data: variables,
|
|
35
|
+
props
|
|
36
|
+
});
|
|
37
|
+
const boostedVariables = buildQueryBooster(props, updatedVariables);
|
|
38
|
+
|
|
30
39
|
const { data = {}, error, loading, fetchMore } = useQuery(action, {
|
|
31
|
-
variables
|
|
40
|
+
variables: boostedVariables
|
|
32
41
|
});
|
|
42
|
+
|
|
33
43
|
if (loading) return '';
|
|
34
44
|
if (error) return error.message;
|
|
35
45
|
if (!data[actionKey] || !data[actionKey].results) return null;
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { useRouter } from 'next/router';
|
|
4
4
|
import { parseUrl } from 'query-string';
|
|
5
5
|
import { buildAzUrl } from '../../helpers';
|
|
6
|
+
import BlazeLink from '../../../BlazeLink';
|
|
6
7
|
|
|
7
8
|
const ListHeader = ({ name, listAggregations, azFilter }) => {
|
|
8
9
|
const router = useRouter();
|
|
@@ -12,7 +13,8 @@ const ListHeader = ({ name, listAggregations, azFilter }) => {
|
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
15
|
<div className="az_list_filter flex">
|
|
15
|
-
<
|
|
16
|
+
<BlazeLink
|
|
17
|
+
ariaLabel="Show all"
|
|
16
18
|
className={`az_list_filter_option${!azFilter ? ' selected' : ''} flex-grow`}
|
|
17
19
|
href={allHref}
|
|
18
20
|
onClick={e => {
|
|
@@ -20,7 +22,7 @@ const ListHeader = ({ name, listAggregations, azFilter }) => {
|
|
|
20
22
|
return router.push('/Resolver', allHref, { shallow: true });
|
|
21
23
|
}}>
|
|
22
24
|
ALL
|
|
23
|
-
</
|
|
25
|
+
</BlazeLink>
|
|
24
26
|
{listAggregations.map(({ key, doc_count: count }) => {
|
|
25
27
|
if (!count)
|
|
26
28
|
return (
|
|
@@ -34,7 +36,8 @@ const ListHeader = ({ name, listAggregations, azFilter }) => {
|
|
|
34
36
|
const className = `az_list_filter_option${isSelected ? ' selected' : ''} flex-grow`;
|
|
35
37
|
|
|
36
38
|
return (
|
|
37
|
-
<
|
|
39
|
+
<BlazeLink
|
|
40
|
+
ariaLabel={`Filter by ${key}`}
|
|
38
41
|
key={key}
|
|
39
42
|
className={className}
|
|
40
43
|
href={href}
|
|
@@ -43,7 +46,7 @@ const ListHeader = ({ name, listAggregations, azFilter }) => {
|
|
|
43
46
|
return router.push('/Resolver', href, { shallow: true });
|
|
44
47
|
}}>
|
|
45
48
|
{key}
|
|
46
|
-
</
|
|
49
|
+
</BlazeLink>
|
|
47
50
|
);
|
|
48
51
|
})}
|
|
49
52
|
</div>
|
|
@@ -22,7 +22,7 @@ const Classic = ({ name, numberOfPages, currentPage, query, url, isLastPage, onC
|
|
|
22
22
|
onClick={onClick}
|
|
23
23
|
shallow
|
|
24
24
|
scroll>
|
|
25
|
-
{PREVIOUS_STRING}
|
|
25
|
+
{`${PREVIOUS_STRING} page`}
|
|
26
26
|
</BlazeLink>
|
|
27
27
|
)}
|
|
28
28
|
{pages}
|
|
@@ -33,7 +33,7 @@ const Classic = ({ name, numberOfPages, currentPage, query, url, isLastPage, onC
|
|
|
33
33
|
onClick={onClick}
|
|
34
34
|
shallow
|
|
35
35
|
scroll>
|
|
36
|
-
{NEXT_STRING}
|
|
36
|
+
{`${NEXT_STRING} page`}
|
|
37
37
|
</BlazeLink>
|
|
38
38
|
)}
|
|
39
39
|
</>
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { LOAD_MORE_STRING } from '../../../../constants';
|
|
4
4
|
import buildPaginationUrl from '../../helpers/build-pagination-url';
|
|
5
|
+
import BlazeLink from '../../../BlazeLink';
|
|
5
6
|
|
|
6
7
|
const LoadMore = ({ name, currentPage, query, url, triggerInfiniteScroll, isLastPage }) => {
|
|
7
8
|
if (isLastPage) return null;
|
|
@@ -15,9 +16,13 @@ const LoadMore = ({ name, currentPage, query, url, triggerInfiniteScroll, isLast
|
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
18
|
<>
|
|
18
|
-
<
|
|
19
|
+
<BlazeLink
|
|
20
|
+
className="pagination_load-more"
|
|
21
|
+
role="button"
|
|
22
|
+
href={nextPageLink}
|
|
23
|
+
onClick={loadMoreItems}>
|
|
19
24
|
{LOAD_MORE_STRING}
|
|
20
|
-
</
|
|
25
|
+
</BlazeLink>
|
|
21
26
|
</>
|
|
22
27
|
);
|
|
23
28
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const buildQueryBooster = (props, data) => {
|
|
2
|
+
const { recencyBoostProperty } = props;
|
|
3
|
+
|
|
4
|
+
if (!recencyBoostProperty || !recencyBoostProperty.length) return data;
|
|
5
|
+
const { rawQueryStringified = '' } = data;
|
|
6
|
+
|
|
7
|
+
const parsedRawQuery = JSON.parse(rawQueryStringified);
|
|
8
|
+
const { function_score: { query, functions = [] } = {} } = parsedRawQuery;
|
|
9
|
+
|
|
10
|
+
const boostedPropsFunctios = recencyBoostProperty.map(propToBoost => ({
|
|
11
|
+
gauss: {
|
|
12
|
+
[propToBoost]: {
|
|
13
|
+
origin: 'now',
|
|
14
|
+
scale: '30d',
|
|
15
|
+
offset: '7d',
|
|
16
|
+
decay: 0.5
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const updatedData = {
|
|
22
|
+
function_score: {
|
|
23
|
+
query: functions.length ? query : parsedRawQuery,
|
|
24
|
+
functions: [...functions, ...boostedPropsFunctios],
|
|
25
|
+
boost_mode: 'multiply'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...data,
|
|
31
|
+
rawQueryStringified: JSON.stringify(updatedData)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default buildQueryBooster;
|
|
@@ -9,3 +9,4 @@ export { default as hasRequiredItemListDetails } from './has-required-item-list-
|
|
|
9
9
|
export { default as getListComponent } from './get-list-component';
|
|
10
10
|
export { default as getListQuery } from './get-list-query';
|
|
11
11
|
export { default as getListSpecificSearchFilter } from './get-list-specific-search-filter';
|
|
12
|
+
export { default as buildQueryBooster } from './build-query-booster';
|
|
@@ -6,6 +6,7 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import { MdMenu, MdClose } from 'react-icons/md';
|
|
7
7
|
import { Link } from '@blaze-cms/nextjs-components';
|
|
8
8
|
import MenuContext from './MenuContext';
|
|
9
|
+
import BlazeLink from '../BlazeLink';
|
|
9
10
|
|
|
10
11
|
const Menu = ({
|
|
11
12
|
children,
|
|
@@ -22,7 +23,6 @@ const Menu = ({
|
|
|
22
23
|
logoOnMobileAlt,
|
|
23
24
|
logoOnMobileModifier,
|
|
24
25
|
logoOnDesktopModifier,
|
|
25
|
-
logoOnDesktopAlignment,
|
|
26
26
|
closeIconModifier
|
|
27
27
|
}) => {
|
|
28
28
|
const router = useRouter();
|
|
@@ -62,7 +62,8 @@ const Menu = ({
|
|
|
62
62
|
className={`flex w-screen z-50 justify-${mobileIconAlignment} ${isMobileMenuExpanded}`}>
|
|
63
63
|
<BlazeButton
|
|
64
64
|
className={`menu--mobile-button ${mobileButtonModifier}`}
|
|
65
|
-
onClick={() => setShowMobileMenu(!showMobileMenu)}
|
|
65
|
+
onClick={() => setShowMobileMenu(!showMobileMenu)}
|
|
66
|
+
aria-label={showMobileMenu ? 'Close mobile menu' : 'Open mobile menu'}>
|
|
66
67
|
<i>
|
|
67
68
|
{showMobileMenu ? (
|
|
68
69
|
<MdClose className={closeIconModifier} />
|
|
@@ -76,7 +77,7 @@ const Menu = ({
|
|
|
76
77
|
)}
|
|
77
78
|
{logoOnMobile &&
|
|
78
79
|
!showMobileMenu && (
|
|
79
|
-
<Link href="/">
|
|
80
|
+
<Link href="/" name="mobile menu">
|
|
80
81
|
<img src={logoOnMobileUrl} alt={logoOnMobileAlt} className={logoOnMobileModifier} />
|
|
81
82
|
</Link>
|
|
82
83
|
)}
|
|
@@ -84,13 +85,13 @@ const Menu = ({
|
|
|
84
85
|
<div className="menu--desktop-wrapper">
|
|
85
86
|
<ul className={childModifiers}>
|
|
86
87
|
{logoOnDesktop && (
|
|
87
|
-
<
|
|
88
|
+
<BlazeLink href="/" className="">
|
|
88
89
|
<img
|
|
89
90
|
src={logoOnMobileUrl}
|
|
90
91
|
alt={logoOnMobileAlt}
|
|
91
92
|
className={logoOnDesktopModifier}
|
|
92
93
|
/>
|
|
93
|
-
</
|
|
94
|
+
</BlazeLink>
|
|
94
95
|
)}
|
|
95
96
|
{children}
|
|
96
97
|
</ul>
|
|
@@ -108,7 +109,6 @@ Menu.propTypes = {
|
|
|
108
109
|
logoOnMobileAlt: PropTypes.string,
|
|
109
110
|
logoOnMobileModifier: PropTypes.string,
|
|
110
111
|
logoOnDesktopModifier: PropTypes.string,
|
|
111
|
-
logoOnDesktopAlignment: PropTypes.string,
|
|
112
112
|
hamburgerIconModifier: PropTypes.string,
|
|
113
113
|
closeIconModifier: PropTypes.string,
|
|
114
114
|
mobileButtonModifier: PropTypes.string,
|
|
@@ -131,7 +131,6 @@ Menu.defaultProps = {
|
|
|
131
131
|
mobileIconAlignment: '',
|
|
132
132
|
mobileMenuModifier: '',
|
|
133
133
|
mobileMenuChildrenModifier: '',
|
|
134
|
-
logoOnDesktopAlignment: 'left',
|
|
135
134
|
modifier: '',
|
|
136
135
|
children: []
|
|
137
136
|
};
|
|
@@ -33,7 +33,11 @@ const MenuItem = ({ children, eventType, text, modifier, url }) => {
|
|
|
33
33
|
const hasValidChildren = hasChildren(children);
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<li
|
|
36
|
+
<li
|
|
37
|
+
className={modifier}
|
|
38
|
+
onMouseEnter={handleItemEvent}
|
|
39
|
+
onMouseLeave={handleItemEvent}
|
|
40
|
+
aria-label={text}>
|
|
37
41
|
<div className="menu--item--link">
|
|
38
42
|
{url ? (
|
|
39
43
|
<BlazeLink href={url}>{text}</BlazeLink>
|
|
@@ -51,7 +55,6 @@ const MenuItem = ({ children, eventType, text, modifier, url }) => {
|
|
|
51
55
|
</i>
|
|
52
56
|
)}
|
|
53
57
|
</div>
|
|
54
|
-
|
|
55
58
|
{hasValidChildren && (
|
|
56
59
|
<div className={`menu--item-children ${childrenDisplayClass}`}>{children}</div>
|
|
57
60
|
)}
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { SOCIAL_NETWORKS, BASE_CLASS_NAME_FOLLOW } from './sf.config';
|
|
5
|
+
import BlazeLink from '../BlazeLink';
|
|
5
6
|
|
|
6
7
|
const SFItem = ({ url, id }) => {
|
|
7
8
|
const { name, className, Icon, spanClassName } = SOCIAL_NETWORKS[id];
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<li className={BASE_CLASS_NAME_FOLLOW}>
|
|
11
|
-
<
|
|
12
|
+
<BlazeLink
|
|
13
|
+
href={url}
|
|
14
|
+
className={className}
|
|
15
|
+
rel="noopener nofollow"
|
|
16
|
+
target="_blank"
|
|
17
|
+
ariaLabel={name}>
|
|
12
18
|
<i>
|
|
13
19
|
<Icon />
|
|
14
20
|
</i>
|
|
15
21
|
<span className={`social__network ${spanClassName}`}>{name}</span>
|
|
16
|
-
</
|
|
22
|
+
</BlazeLink>
|
|
17
23
|
</li>
|
|
18
24
|
);
|
|
19
25
|
};
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Player } from 'video-react';
|
|
4
|
+
import { VIDEO_WRAPPER_CLASS_NAME } from '../../../constants';
|
|
5
|
+
|
|
4
6
|
// import 'video-react/styles/scss/video-react.scss';
|
|
5
7
|
|
|
6
|
-
const Default = ({ modifier, url, autoplay }) => (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
8
|
+
const Default = ({ modifier, url, autoplay, loop }) => (
|
|
9
|
+
<div className={VIDEO_WRAPPER_CLASS_NAME}>
|
|
10
|
+
<Player className={modifier} preload="none" autoPlay={autoplay} loop={loop} muted={autoplay}>
|
|
11
|
+
<source src={url} />
|
|
12
|
+
</Player>
|
|
13
|
+
</div>
|
|
10
14
|
);
|
|
11
15
|
|
|
12
16
|
Default.propTypes = {
|
|
13
17
|
url: PropTypes.string.isRequired,
|
|
14
18
|
modifier: PropTypes.string,
|
|
15
|
-
autoplay: PropTypes.bool
|
|
19
|
+
autoplay: PropTypes.bool,
|
|
20
|
+
loop: PropTypes.bool
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
Default.defaultProps = {
|
|
19
24
|
modifier: null,
|
|
20
|
-
autoplay: false
|
|
25
|
+
autoplay: false,
|
|
26
|
+
loop: false
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
export default Default;
|
|
@@ -8,7 +8,8 @@ const SUPPORTED_PROVIDERS = {
|
|
|
8
8
|
import(/* webpackChunkName: "blazePbVideoJWPlayer" */ './JWPlayer/JWPlayerProvider')
|
|
9
9
|
),
|
|
10
10
|
vimeo: dynamic(() => import(/* webpackChunkName: "blazePbVideoVimeo" */ './Vimeo/VimeoProvider')),
|
|
11
|
-
default: dynamic(() => import(/* webpackChunkName: "blazePbVideoDefault" */ './Default'))
|
|
11
|
+
default: dynamic(() => import(/* webpackChunkName: "blazePbVideoDefault" */ './Default')),
|
|
12
|
+
html: dynamic(() => import(/* webpackChunkName: "blazePbVideoDefault" */ './Default'))
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
function getProvider(provider) {
|
|
@@ -3,6 +3,7 @@ import { variantHandler } from '../../utils';
|
|
|
3
3
|
export default function getVariant(settings) {
|
|
4
4
|
const { variant } = settings;
|
|
5
5
|
if (!variant) return [null, {}];
|
|
6
|
+
|
|
6
7
|
const { VariantComponent, getSettings } = variantHandler.get(variant) || {};
|
|
7
8
|
const variantSettings =
|
|
8
9
|
!!getSettings && typeof getSettings === 'function' ? getSettings(settings) : settings;
|
package/src/hooks/index.js
CHANGED
|
@@ -6,3 +6,4 @@ export { default as usePageBuilder } from './use-page-builder';
|
|
|
6
6
|
export { default as useGetSingleEntitySchema } from './use-get-single-entity-schema';
|
|
7
7
|
export { default as useCheckMobileScreen } from './use-check-mobile-screen';
|
|
8
8
|
export { default as useBannerInsertion } from './use-banner-insertion';
|
|
9
|
+
export { default as useAppSyncEventHook } from './use-app-sync-event-hook';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { AppContext } from '@blaze-cms/nextjs-components';
|
|
3
|
+
|
|
4
|
+
const EVENET_PREFIX = 'plugin:page-builder:';
|
|
5
|
+
const EVENET_SUFIX = ':sync';
|
|
6
|
+
|
|
7
|
+
const useAppSyncEventHook = ({ eventName, data, props }) => {
|
|
8
|
+
const { blazeApp } = useContext(AppContext);
|
|
9
|
+
if (!blazeApp) return { data };
|
|
10
|
+
|
|
11
|
+
blazeApp.events.emit(`${EVENET_PREFIX}${eventName}${EVENET_SUFIX}`, {
|
|
12
|
+
data,
|
|
13
|
+
props
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return { data };
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default useAppSyncEventHook;
|
|
@@ -18,7 +18,8 @@ function variantMapHandler() {
|
|
|
18
18
|
|
|
19
19
|
function validate(key, variant) {
|
|
20
20
|
if (!key || !variant) throw new BlazeError('Variant requires key and component');
|
|
21
|
-
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
if (variants.has(key) && key !== 'array') console.warn(`Variant already exists: ${key}`); // todo: restore error // throw new BlazeError(`Variant already exists: ${key}`);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
return {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useInfographic from './useInfographic';
|
|
3
|
+
|
|
4
|
+
const Infographic = props => {
|
|
5
|
+
const { contentRef, id, className, tabId, children } = useInfographic(props);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div ref={contentRef} id={id} className={className} role="tabpanel" aria-labelledby={tabId}>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Infographic;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import dynamic from 'next/dynamic';
|
|
2
|
+
|
|
3
|
+
const Infographic = {
|
|
4
|
+
getSettings: componentSettings => ({
|
|
5
|
+
...componentSettings
|
|
6
|
+
}),
|
|
7
|
+
VariantComponent: dynamic(() =>
|
|
8
|
+
import(/* webpackChunkName: "blazePbVariantInfographic" */ './Infographic')
|
|
9
|
+
)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default Infographic;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
2
|
+
|
|
3
|
+
const useInfographic = ({ className: _className, ...props }) => {
|
|
4
|
+
const [isIntersecting, contentRef] = useInView({
|
|
5
|
+
once: true,
|
|
6
|
+
offset: '200px'
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const className = `${_className} infographic${isIntersecting ? ' infographic__active' : ''}`;
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
...props,
|
|
13
|
+
className,
|
|
14
|
+
contentRef
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default useInfographic;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withTitle } from '../../HOC';
|
|
3
|
+
import useLongformGallery from './useLongformGallery';
|
|
4
|
+
import LongformGalleryImage from './LongformGalleryImage';
|
|
5
|
+
|
|
6
|
+
const LongformGallery = props => {
|
|
7
|
+
const {
|
|
8
|
+
loading,
|
|
9
|
+
error,
|
|
10
|
+
groupedImages,
|
|
11
|
+
shouldDisplayCaption,
|
|
12
|
+
caption,
|
|
13
|
+
handleImageOnClick
|
|
14
|
+
} = useLongformGallery(props);
|
|
15
|
+
|
|
16
|
+
if (loading || error || !groupedImages.length) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="longform-gallery" data-testid="longform-gallery">
|
|
20
|
+
{groupedImages.map((imageGroup, i) => (
|
|
21
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
22
|
+
<div key={i} data-testid="grouped-images" className="longform-gallery__images">
|
|
23
|
+
{imageGroup.map(secondaryImage => (
|
|
24
|
+
<LongformGalleryImage
|
|
25
|
+
key={secondaryImage.id}
|
|
26
|
+
{...secondaryImage}
|
|
27
|
+
numberOfImages={imageGroup.length}
|
|
28
|
+
className={
|
|
29
|
+
imageGroup.length > 2
|
|
30
|
+
? 'longform-gallery__images__image secondary-image'
|
|
31
|
+
: 'longform-gallery__images__image main-image'
|
|
32
|
+
}
|
|
33
|
+
handleImageOnClick={handleImageOnClick}
|
|
34
|
+
/>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
))}
|
|
38
|
+
{shouldDisplayCaption && (
|
|
39
|
+
<div className="carousel__details" data-testid="carousel-details">
|
|
40
|
+
<div className="caption">{caption}</div>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default withTitle(LongformGallery);
|