-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
50 lines (43 loc) · 1.55 KB
/
index.tsx
File metadata and controls
50 lines (43 loc) · 1.55 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use client';
import { MagnifyingGlassIcon } from '@heroicons/react/24/solid';
import { SearchInput } from '@orama/ui/components';
import { useTranslations } from 'next-intl';
import type { FC, PropsWithChildren } from 'react';
import { DEFAULT_ORAMA_QUERY_PARAMS } from '#site/next.constants.mjs';
import { useSearchbox } from '#site/providers/searchboxProvider';
import { Footer } from '../Footer';
import { SearchResultsWrapper } from '../SearchResults';
import styles from './index.module.css';
type SearchProps = PropsWithChildren & React.RefAttributes<HTMLInputElement>;
export const Search: FC<SearchProps> = ({ ref }) => {
const t = useTranslations();
const searchbox = useSearchbox();
const isSearchMode = searchbox?.mode === 'search';
return (
<div className={styles.searchContainer}>
<SearchInput.Wrapper className={styles.searchInputWrapper}>
<MagnifyingGlassIcon />
<SearchInput.Input
inputId="orama-doc-search"
ariaLabel={t('components.search.searchPlaceholder')}
placeholder={t('components.search.searchPlaceholder')}
tabIndex={isSearchMode ? 0 : -1}
aria-hidden={!isSearchMode}
className={styles.searchInput}
searchParams={{
...DEFAULT_ORAMA_QUERY_PARAMS,
groupBy: {
properties: ['siteSection'],
},
facets: {
siteSection: {},
},
}}
ref={ref}
/>
</SearchInput.Wrapper>
<SearchResultsWrapper />
<Footer />
</div>
);
};