@treely/strapi-slices 5.3.2 → 5.4.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/components/FullScreenImage/FullScreenImage.d.ts +3 -2
- package/dist/components/portfolio/ProjectInfo/messages.de.d.ts +1 -0
- package/dist/components/portfolio/ProjectInfo/messages.en.d.ts +1 -0
- package/dist/rootMessages.de.d.ts +1 -0
- package/dist/rootMessages.en.d.ts +1 -0
- package/dist/strapi-slices.cjs.development.js +33 -25
- 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 +34 -26
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FullScreenImage/FullScreenImage.tsx +29 -19
- package/src/components/portfolio/ProjectInfo/messages.de.ts +3 -0
- package/src/components/portfolio/ProjectInfo/messages.en.ts +3 -0
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.tsx +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect, Fragment, createRef, createContext, useContext
|
|
1
|
+
import React, { useState, useRef, useMemo, useCallback, useEffect, Fragment, createRef, createContext, useContext } from 'react';
|
|
2
2
|
import Head from 'next/head';
|
|
3
3
|
import { Box, BoemlyModal, Flex, IconButton, useMediaQuery, DefaultSectionContainer, Wrapper, DefaultSectionHeader, Button, Gradient, Spacer, SimpleGrid, Heading, Text, useToken, Grid, GridItem, BoemlyList, PortfolioCard, RichText, BoemlyAccordion, HeroCard, Shape, QuoteCard, Center, ShapesCard, TextCardWithIcon, ContactArea, ProjectCard, Tag, Link as Link$1, DatePersonPair, BoemlyThemeProvider, Badge, useDisclosure, Container, AvatarWithName, Divider, LabelNumberPair, BoemlyFormControl, InputRightAddon, LabelTextPair } from 'boemly';
|
|
4
4
|
import Image from 'next/image';
|
|
@@ -721,45 +721,50 @@ var FullScreenImage = function FullScreenImage(_ref) {
|
|
|
721
721
|
var images = _ref.images,
|
|
722
722
|
isOpen = _ref.isOpen,
|
|
723
723
|
onClose = _ref.onClose,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
setImageIndex = _useState[1];
|
|
724
|
+
_ref$currentIndex = _ref.currentIndex,
|
|
725
|
+
currentIndex = _ref$currentIndex === void 0 ? 0 : _ref$currentIndex,
|
|
726
|
+
setCurrentIndex = _ref.setCurrentIndex;
|
|
728
727
|
var containerRef = useRef(null);
|
|
729
728
|
useLockBodyScroll(isOpen);
|
|
730
|
-
var canMoveRight =
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
729
|
+
var canMoveRight = useMemo(function () {
|
|
730
|
+
return currentIndex < images.length - 1;
|
|
731
|
+
}, [currentIndex, images.length]);
|
|
732
|
+
var canMoveLeft = useMemo(function () {
|
|
733
|
+
return currentIndex !== 0;
|
|
734
|
+
}, [currentIndex]);
|
|
735
|
+
var onRight = useCallback(function () {
|
|
736
|
+
return canMoveRight && setCurrentIndex && setCurrentIndex(function (c) {
|
|
737
|
+
return c + 1;
|
|
735
738
|
});
|
|
736
|
-
};
|
|
737
|
-
var onLeft = function
|
|
738
|
-
return
|
|
739
|
-
return
|
|
739
|
+
}, [canMoveRight]);
|
|
740
|
+
var onLeft = useCallback(function () {
|
|
741
|
+
return canMoveLeft && setCurrentIndex && setCurrentIndex(function (c) {
|
|
742
|
+
return c - 1;
|
|
740
743
|
});
|
|
741
|
-
};
|
|
744
|
+
}, [canMoveLeft]);
|
|
742
745
|
useKey('ArrowRight', onRight, {}, [onRight]);
|
|
743
746
|
useKey('ArrowLeft', onLeft, {}, [onLeft]);
|
|
744
747
|
useEffect(function () {
|
|
745
|
-
if (
|
|
746
|
-
|
|
748
|
+
if (!!isOpen) {
|
|
749
|
+
setTimeout(function () {
|
|
750
|
+
var _containerRef$current;
|
|
751
|
+
containerRef == null || (_containerRef$current = containerRef.current) == null || _containerRef$current.scrollTo({
|
|
752
|
+
left: currentIndex * containerRef.current.clientWidth,
|
|
753
|
+
behavior: 'instant'
|
|
754
|
+
});
|
|
755
|
+
}, 10);
|
|
747
756
|
}
|
|
748
|
-
}, [
|
|
757
|
+
}, [isOpen]);
|
|
749
758
|
useEffect(function () {
|
|
750
759
|
if (containerRef.current) {
|
|
751
760
|
containerRef.current.scrollTo({
|
|
752
|
-
left:
|
|
761
|
+
left: currentIndex * containerRef.current.clientWidth,
|
|
753
762
|
behavior: 'smooth'
|
|
754
763
|
});
|
|
755
764
|
}
|
|
756
|
-
}, [
|
|
757
|
-
var onCloseLocal = function onCloseLocal() {
|
|
758
|
-
setImageIndex(0);
|
|
759
|
-
onClose();
|
|
760
|
-
};
|
|
765
|
+
}, [currentIndex, containerRef]);
|
|
761
766
|
return React.createElement(BoemlyModal, {
|
|
762
|
-
onClose:
|
|
767
|
+
onClose: onClose,
|
|
763
768
|
isOpen: isOpen,
|
|
764
769
|
title: "",
|
|
765
770
|
trigger: "",
|
|
@@ -2038,6 +2043,7 @@ var messagesDe$6 = {
|
|
|
2038
2043
|
'features.projectInfo.properties.projectDeveloper': 'Projekt Entwickler',
|
|
2039
2044
|
'features.projectInfo.properties.verificationStandard.label': 'Verifizierungsstandard',
|
|
2040
2045
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
|
|
2046
|
+
'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
|
|
2041
2047
|
'features.projectInfo.properties.forecastedAmountYear.label': 'Projektvolumen',
|
|
2042
2048
|
'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
|
|
2043
2049
|
'features.projectInfo.properties.year': '{years} {years, plural, one {Jahr} other {Jahre} }'
|
|
@@ -2152,6 +2158,7 @@ var messagesEn$4 = {
|
|
|
2152
2158
|
'features.projectInfo.properties.projectDeveloper': 'Project Developer',
|
|
2153
2159
|
'features.projectInfo.properties.verificationStandard.label': 'Verification Standard',
|
|
2154
2160
|
'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
|
|
2161
|
+
'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
|
|
2155
2162
|
'features.projectInfo.properties.forecastedAmountYear.label': 'Project Volume',
|
|
2156
2163
|
'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
|
|
2157
2164
|
'features.projectInfo.properties.year': '{years} {years, plural, one {year} other {years} }'
|
|
@@ -3326,7 +3333,8 @@ var FullWidthImageSlider = function FullWidthImageSlider(_ref) {
|
|
|
3326
3333
|
images: slice.images.map(function (image) {
|
|
3327
3334
|
return image.img;
|
|
3328
3335
|
}),
|
|
3329
|
-
|
|
3336
|
+
currentIndex: sliderIndex,
|
|
3337
|
+
setCurrentIndex: setSliderIndex,
|
|
3330
3338
|
isOpen: isOpen,
|
|
3331
3339
|
onClose: function onClose() {
|
|
3332
3340
|
return setIsOpen(false);
|