-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
33 lines (28 loc) · 928 Bytes
/
index.tsx
File metadata and controls
33 lines (28 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { SparklesIcon } from '@heroicons/react/24/outline';
import { Suggestions } from '@orama/ui/components/Suggestions';
import type { ComponentProps, FC } from 'react';
import styles from './index.module.css';
type SearchSuggestionsProps = {
suggestions: Array<string>;
label?: string;
} & Omit<ComponentProps<typeof Suggestions.Item>, 'children'>;
const SearchSuggestions: FC<SearchSuggestionsProps> = ({
suggestions,
label,
...props
}) => (
<Suggestions.Wrapper className={styles.suggestionsWrapper}>
{label && <p className={styles.suggestionsTitle}>{label}</p>}
{suggestions.map((suggestion, i) => (
<Suggestions.Item
{...props}
key={`suggestion-${i}`}
className={styles.suggestionItem}
>
<SparklesIcon key={`suggestion-icon-${i}`} />
{suggestion}
</Suggestions.Item>
))}
</Suggestions.Wrapper>
);
export default SearchSuggestions;