diff --git a/ghost/sodo-search/src/components/PopupModal.js b/ghost/sodo-search/src/components/PopupModal.js index 8948b9d771..735d096f04 100644 --- a/ghost/sodo-search/src/components/PopupModal.js +++ b/ghost/sodo-search/src/components/PopupModal.js @@ -18,11 +18,11 @@ const tagsData = [ const postsData = [ { - title: 'How to ergonomically optimize your workspace fkds gfd jgkf gjg jkfg fjkg fkgj fkgjf jgkf jgkfj work gkjf jgkfj ', + title: 'How to ergonomically optimize your workspace fkds gfd jgkf gjg jkfg fjkg fkgj fkgjf jgkf jgkfj work gkjf jgkfj ', excerpt: 'Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.' }, { - title: 'The economical advantage of work', + title: 'The economical advantage of work', excerpt: 'New data show the end of pandemic coincided with a 49 percent increase in the number of families struggling to survive.' }, { @@ -267,17 +267,17 @@ function PostListItem({post, selectedResult, setSelectedResult}) { setSelectedResult(id); }} > -

+

- +

); } -function HighlightedSection({text = '', highlight = ''}) { +function HighlightedSection({text = '', highlight = '', isExcerpt}) { let highlightStartIndex = text?.toLowerCase().indexOf(highlight.toLowerCase()); let parts = []; @@ -322,7 +322,7 @@ function HighlightedSection({text = '', highlight = ''}) { if (d?.type === 'highlight') { return ( - + ); } else { @@ -340,12 +340,19 @@ function HighlightedSection({text = '', highlight = ''}) { ); } -function HighlightWord({word, highlight}) { +function HighlightWord({word, highlight, isExcerpt}) { const firstHalf = word.slice(0, (highlight?.length || 0)) || ''; const secondHalf = word.slice((highlight?.length || 0), (word?.length || 1000)) || ''; + if (isExcerpt) { + return ( + <> + {firstHalf}{secondHalf} + + ); + } return ( <> - {firstHalf}{secondHalf} + {firstHalf}{secondHalf} ); }