From f867165c178110854c7f0a10ee2197a7aa879552 Mon Sep 17 00:00:00 2001 From: DanielCliftonGuardian <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:57:30 +0000 Subject: [PATCH] Update ShareButton.importable.tsx --- .../src/components/ShareButton.importable.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/components/ShareButton.importable.tsx b/dotcom-rendering/src/components/ShareButton.importable.tsx index a80f8b7589..e7c4a4dc77 100644 --- a/dotcom-rendering/src/components/ShareButton.importable.tsx +++ b/dotcom-rendering/src/components/ShareButton.importable.tsx @@ -189,6 +189,12 @@ export const ShareButton = ({ const isLiveBlogMeta = format.design === ArticleDesign.LiveBlog && context === 'ArticleMeta'; + const isLiveBlogBlockDesktop = + typeof window !== 'undefined' && + format.design === ArticleDesign.LiveBlog && + context === 'LiveBlock' && + window.innerWidth > 980; + const shareData = useMemo( () => ({ title: webTitle, @@ -202,14 +208,18 @@ export const ShareButton = ({ ); useEffect(() => { - if ('share' in navigator && navigator.canShare(shareData)) { + if ( + !isLiveBlogBlockDesktop && + 'share' in navigator && + navigator.canShare(shareData) + ) { setButtonKind('native'); } else if ('clipboard' in navigator) { setButtonKind('copy'); } else { setButtonKind('email'); } - }, [shareData]); + }, [shareData, isLiveBlogBlockDesktop]); useEffect(() => { if (!isCopied) return;