import * as preact from "preact"; /** @jsx preact.h */ // TODO :: restore highlight /*function highlightText(search, text) { if (settings.highlightTerms) { var pattern = new RegExp( `(${search})`, settings.highlightEveryTerm ? "gi" : "i" ); text = text.replace( pattern, '$1' ); } return text; }*/ export default function Result({ settings, item }) { let text; if (item.text) { text = item.text .split(" ") .slice(0, settings.descriptiveWords) .join(" "); if ( item.text.length < text.length && text.charAt(text.length - 1) !== "." ) { text += " ..."; } } return (
{item.title}
{settings.showURL && (
{item.url.toLowerCase().replace(/https?:\/\//g, "")}
)} {text &&
{text}
}
); }