From e45a59418d1bcbd71f5a05700896161e8e61ecdb Mon Sep 17 00:00:00 2001 From: Raphaelle Cantin Date: Tue, 17 Dec 2024 09:43:24 +0000 Subject: [PATCH 1/4] Change ID in image galleries to avoid duplicates --- .../views/slices/EditorialImageGallery/index.tsx | 8 ++------ content/webapp/components/ImageGallery/index.tsx | 15 ++++++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common/views/slices/EditorialImageGallery/index.tsx b/common/views/slices/EditorialImageGallery/index.tsx index 9026149b99..f52ffda261 100644 --- a/common/views/slices/EditorialImageGallery/index.tsx +++ b/common/views/slices/EditorialImageGallery/index.tsx @@ -17,23 +17,19 @@ export type EditorialImageGalleryProps = SliceComponentProps< const EditorialImageGallerySlice: FunctionComponent< EditorialImageGalleryProps -> = ({ slice, slices, context }) => { +> = ({ slice, context }) => { const isStandalone = context.contentType === 'standalone-image-gallery'; const transformedSlice = transformEditorialImageGallerySlice( slice, isStandalone ); const options = { ...defaultContext, ...context }; - const allImageGallerySlices = slices.filter( - slice => slice.slice_type === 'editorialImageGallery' - ); - const index = allImageGallerySlices.findIndex(s => s.id === slice.id); return transformedSlice.value.items?.length ? ( diff --git a/content/webapp/components/ImageGallery/index.tsx b/content/webapp/components/ImageGallery/index.tsx index a879594d53..8d67a05296 100644 --- a/content/webapp/components/ImageGallery/index.tsx +++ b/content/webapp/components/ImageGallery/index.tsx @@ -10,6 +10,7 @@ import { cross, gallery } from '@weco/common/icons'; import { CaptionedImage as CaptionedImageProps } from '@weco/common/model/captioned-image'; import { repeatingLsBlack } from '@weco/common/utils/backgrounds'; import { font } from '@weco/common/utils/classnames'; +import { dasherize } from '@weco/common/utils/grammar'; import Button from '@weco/common/views/components/Buttons'; import Control from '@weco/common/views/components/Control'; import Icon from '@weco/common/views/components/Icon/Icon'; @@ -71,7 +72,7 @@ export type Props = { comicPreviousNext?: ComicPreviousNextProps; }; -const ImageGallery: FunctionComponent<{ id: number } & Props> = ({ +const ImageGallery: FunctionComponent<{ id: string } & Props> = ({ id, title, items, @@ -140,14 +141,18 @@ const ImageGallery: FunctionComponent<{ id: number } & Props> = ({ -

+

{title || 'In pictures'}

)} = ({ = ({