From fb89ca5e335382b9b8d434b7082743318feac493 Mon Sep 17 00:00:00 2001
From: Karan Sheth <karan.sheth60@gmail.com>
Date: Wed, 7 Dec 2022 14:39:37 -0500
Subject: [PATCH] Frontend change for BENTO-2193.

---
 src/pages/search/components/cards/aboutCard.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/pages/search/components/cards/aboutCard.js b/src/pages/search/components/cards/aboutCard.js
index 2685afb2..2357b9fb 100644
--- a/src/pages/search/components/cards/aboutCard.js
+++ b/src/pages/search/components/cards/aboutCard.js
@@ -5,11 +5,20 @@ import { Anchor } from 'bento-components';
 const AboutCard = ({
   searchText, data, classes, index,
 }) => {
-  const results = data.text.replaceAll('$', '');
+  const results = data.text.map((result) => result.replaceAll('$', ''));
 
   function getHighlightedText(text, highlight) {
     // Split on highlight term and include term into parts, ignore case
-    const parts = text.split(new RegExp(`(${highlight})`, 'gi'));
+    const textString = text.reduce((searchResults, currentString, currentIndex) => {
+      let newResults = searchResults;
+      if (currentString.endsWith('.') || currentIndex >= text.length - 1) {
+        newResults = `${`${newResults} ${currentString}`}`;
+      } else {
+        newResults = `${`${newResults} ${currentString}`} ... `;
+      }
+      return newResults;
+    }, '');
+    const parts = textString.split(new RegExp(`(${highlight})`, 'gi'));
     return (
       <span>
         {' '}