Skip to content

Commit 2f89387

Browse files
committed
Use new SocialShare component in Gallery
1 parent bd62550 commit 2f89387

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

app/[localeCode]/media/album/[uuid]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default async function AlbumPage({ params, searchParams }: Props) {
4141
localeCode={params.localeCode}
4242
gallery={gallery}
4343
href={generateAbsoluteUrl('mediaGallery', { uuid: gallery.uuid })}
44-
withSharingIcons={themeSettings.show_sharing_icons}
44+
socialNetworks={themeSettings.sharing_actions}
4545
/>
4646
</>
4747
);

components/SocialShare/SocialShare.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import classNames from 'classnames';
24
import {
35
FacebookShareButton,

modules/Gallery/Gallery.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Galleries } from '@prezly/theme-kit-nextjs';
44

55
import { ContentRenderer } from '@/components/ContentRenderer';
66
import { PageTitle } from '@/components/PageTitle';
7-
import { StoryLinks } from '@/components/StoryLinks';
7+
import { SocialShare } from '@/components/SocialShare';
8+
import type { SocialNetwork } from 'theme-settings';
89

910
import { DownloadLink } from './DownloadLink';
1011

@@ -14,10 +15,10 @@ interface Props {
1415
localeCode: Locale.Code;
1516
gallery: NewsroomGallery;
1617
href: string;
17-
withSharingIcons: boolean;
18+
socialNetworks: SocialNetwork[];
1819
}
1920

20-
export function Gallery({ localeCode, gallery, href, withSharingIcons }: Props) {
21+
export function Gallery({ localeCode, gallery, href, socialNetworks }: Props) {
2122
const { name, description, content } = gallery;
2223

2324
const downloadUrl =
@@ -30,7 +31,13 @@ export function Gallery({ localeCode, gallery, href, withSharingIcons }: Props)
3031

3132
<div className={styles.links}>
3233
{downloadUrl && <DownloadLink localeCode={localeCode} href={downloadUrl} />}
33-
{withSharingIcons && <StoryLinks url={href} className={styles.shareLinks} />}
34+
{socialNetworks.length > 0 && href && (
35+
<SocialShare
36+
socialNetworks={socialNetworks}
37+
url={href}
38+
className={styles.shareLinks}
39+
/>
40+
)}
3441
</div>
3542

3643
<ContentRenderer nodes={JSON.parse(content)} />

0 commit comments

Comments
 (0)