Skip to content

Commit

Permalink
chore: lint (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahdayan authored Jan 26, 2022
1 parent 2bd40e4 commit 05575dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions examples/react-renderer/src/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Hit } from '@algolia/client-search';
import algoliasearch from 'algoliasearch/lite';
import React from 'react';

import { Highlight } from './Highlight';
import { ClearIcon } from './ClearIcon';
import { Highlight } from './Highlight';
import { SearchIcon } from './SearchIcon';

const searchClient = algoliasearch(
Expand Down Expand Up @@ -170,9 +170,7 @@ export function Autocomplete(
/>
</div>
<div className="aa-ItemContentBody">
<div
className="aa-ItemContentTitle"
>
<div className="aa-ItemContentTitle">
<Highlight hit={item} attribute="name" />
</div>
<div className="aa-ItemContentDescription">
Expand Down
10 changes: 6 additions & 4 deletions examples/react-renderer/src/Highlight.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createElement, Fragment } from "react";
import { parseAlgoliaHitHighlight } from "@algolia/autocomplete-preset-algolia";
import { parseAlgoliaHitHighlight } from '@algolia/autocomplete-preset-algolia';
import { createElement, Fragment } from 'react';

type HighlightHitParams<THit> = {
/**
Expand All @@ -23,14 +23,16 @@ type HighlightHitParams<THit> = {
export function Highlight<THit>({
hit,
attribute,
tagName = "mark",
tagName = 'mark',
}: HighlightHitParams<THit>): JSX.Element {
return createElement(
Fragment,
{},
parseAlgoliaHitHighlight<THit>({ hit, attribute }).map(
({ value, isHighlighted }, index) => {
if (isHighlighted) return createElement(tagName, { key: index }, value);
if (isHighlighted) {
return createElement(tagName, { key: index }, value);
}

return value;
}
Expand Down

0 comments on commit 05575dd

Please sign in to comment.