Skip to content

Commit 3cf168c

Browse files
committed
add lightbox for gallery in app
1 parent a43c3af commit 3cf168c

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

dotcom-rendering/src/components/GalleryImage.tsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { getImage } from '../lib/image';
77
import { palette } from '../palette';
88
import { type ImageBlockElement } from '../types/content';
99
import { type RenderingTarget } from '../types/renderingTarget';
10+
import { AppsLightboxImage } from './AppsLightboxImage.importable';
1011
import { GalleryCaption } from './GalleryCaption';
12+
import { Island } from './Island';
1113
import { LightboxLink } from './LightboxLink';
1214
import { Picture } from './Picture';
1315

@@ -84,15 +86,30 @@ export const GalleryImage = ({
8486
maxWidth: `calc(${width / height} * 96vh)`,
8587
}}
8688
>
87-
<Picture
88-
alt={image.data.alt ?? ''}
89-
format={format}
90-
role={image.role}
91-
master={asset.url}
92-
width={width}
93-
height={height}
94-
loading="lazy"
95-
/>
89+
{renderingTarget === 'Apps' ? (
90+
<Island priority="critical">
91+
<AppsLightboxImage
92+
elementId={image.elementId}
93+
role={image.role}
94+
format={format}
95+
master={asset.url}
96+
alt={image.data.alt ?? ''}
97+
width={width}
98+
height={height}
99+
loading={'lazy'}
100+
/>
101+
</Island>
102+
) : (
103+
<Picture
104+
alt={image.data.alt ?? ''}
105+
format={format}
106+
role={image.role}
107+
master={asset.url}
108+
width={width}
109+
height={height}
110+
loading="lazy"
111+
/>
112+
)}
96113
{renderingTarget === 'Web' && !isUndefined(image.position) && (
97114
<LightboxLink
98115
role={image.role}

0 commit comments

Comments
 (0)