Fixed a substition blunder

This commit is contained in:
Piotr Janosz
2019-08-17 12:40:14 +02:00
committed by fabioberger
parent d4c771dc7d
commit 0d71ec93e7
4 changed files with 18 additions and 16 deletions

View File

@@ -96,11 +96,13 @@ const CustomAutoComplete: React.FC<IAutoCompleteProps> = ({
const renderSuggestion = (hit: IHit): React.ReactNode => {
const { externalUrl, urlWithHash } = hit;
const to = externalUrl ? externalUrl : urlWithHash;
// The atrributes to snippet are set in algolia_constants
const attributeToSnippet = externalUrl ? 'description' : 'textContent';
return (
<Link shouldOpenInNewTab={externalUrl ? true : false} to={to}>
<Highlight attribute="title" hit={hit} nonHighlightedTagName="h6" />
<Snippet attribute="textContent" hit={hit} nonHighlightedTagName="p" tagName="span" />
<Snippet attribute={attributeToSnippet} hit={hit} nonHighlightedTagName="p" tagName="span" />
</Link>
);
};