From ae1d7426beb0b76745e75c1d0fef41c757048c17 Mon Sep 17 00:00:00 2001 From: ibrahim-mamdouh-ft Date: Tue, 27 Aug 2024 12:15:28 +0300 Subject: [PATCH] feat: add preview to shared links --- components/x-gift-article/src/GiftArticle.jsx | 2 +- .../x-gift-article/src/IncludeHighlights.jsx | 8 +++---- .../x-gift-article/src/SocialShareButtons.jsx | 24 ++++++++++++++----- .../src/lib/highlightsHelpers.js | 3 +++ .../src/lib/share-link-actions.js | 6 +++-- components/x-gift-article/src/lib/updaters.js | 4 ++-- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/components/x-gift-article/src/GiftArticle.jsx b/components/x-gift-article/src/GiftArticle.jsx index 21d0ce9eb..cba9d9624 100644 --- a/components/x-gift-article/src/GiftArticle.jsx +++ b/components/x-gift-article/src/GiftArticle.jsx @@ -313,7 +313,7 @@ const withGiftFormActions = withActions( mailtoUrls: { gift: undefined, enterprise: undefined, - nonGift: createMailtoUrl(props.article.title, `${props.article.url}?shareType=nongift`) + nonGift: createMailtoUrl(props, `${props.article.url}?shareType=nongift`) }, showFreeArticleAlert: false } diff --git a/components/x-gift-article/src/IncludeHighlights.jsx b/components/x-gift-article/src/IncludeHighlights.jsx index 68839a550..6c5ed7e39 100644 --- a/components/x-gift-article/src/IncludeHighlights.jsx +++ b/components/x-gift-article/src/IncludeHighlights.jsx @@ -1,5 +1,5 @@ import { h } from '@financial-times/x-engine' -import { canShareWithNonSubscribers, isNonSubscriberOption } from './lib/highlightsHelpers' +import { canShareWithNonSubscribers, isNonSubscriberOption, trimHighlights } from './lib/highlightsHelpers' export const IncludeHighlights = (props) => { const { actions, highlight, enterpriseEnabled, includeHighlights } = props @@ -17,9 +17,9 @@ export const IncludeHighlights = (props) => { className="o-forms-field o-forms-field--optional o-forms-field--professional share-article-dialog__include-highlights" role="group" > -

- {highlight.split(' ').length > 30 ? `${highlight.split(' ').slice(0, 30).join(' ')} ...` : highlight} -

+ {includeHighlights && ( +

{trimHighlights(highlight)}

+ )}