Skip to content

Commit

Permalink
Frontend change for BENTO-2193.
Browse files Browse the repository at this point in the history
  • Loading branch information
iksheth committed Dec 7, 2022
1 parent c3313e4 commit fb89ca5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/pages/search/components/cards/aboutCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>
{' '}
Expand Down

0 comments on commit fb89ca5

Please sign in to comment.