|
@@ -9,14 +9,14 @@ import type { GetItemProps } from '../interfaces/downshift';
|
|
|
import { SearchMenuItem } from './SearchMenuItem';
|
|
import { SearchMenuItem } from './SearchMenuItem';
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
- highlightedIndex: number | null
|
|
|
|
|
|
|
+ activeIndex: number | null
|
|
|
searchKeyword: string
|
|
searchKeyword: string
|
|
|
getItemProps: GetItemProps
|
|
getItemProps: GetItemProps
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const SearchMethodMenuItem = (props: Props): JSX.Element => {
|
|
export const SearchMethodMenuItem = (props: Props): JSX.Element => {
|
|
|
const {
|
|
const {
|
|
|
- highlightedIndex, searchKeyword, getItemProps,
|
|
|
|
|
|
|
+ activeIndex, searchKeyword, getItemProps,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
const { t } = useTranslation('commons');
|
|
const { t } = useTranslation('commons');
|
|
@@ -30,7 +30,7 @@ export const SearchMethodMenuItem = (props: Props): JSX.Element => {
|
|
|
{ shouldShowMenuItem && (
|
|
{ shouldShowMenuItem && (
|
|
|
<SearchMenuItem
|
|
<SearchMenuItem
|
|
|
index={0}
|
|
index={0}
|
|
|
- highlightedIndex={highlightedIndex}
|
|
|
|
|
|
|
+ isActive={activeIndex === 0}
|
|
|
getItemProps={getItemProps}
|
|
getItemProps={getItemProps}
|
|
|
url={`/_search?q=${searchKeyword}`}
|
|
url={`/_search?q=${searchKeyword}`}
|
|
|
>
|
|
>
|
|
@@ -44,7 +44,7 @@ export const SearchMethodMenuItem = (props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
<SearchMenuItem
|
|
<SearchMenuItem
|
|
|
index={shouldShowMenuItem ? 1 : 0}
|
|
index={shouldShowMenuItem ? 1 : 0}
|
|
|
- highlightedIndex={highlightedIndex}
|
|
|
|
|
|
|
+ isActive={activeIndex === (shouldShowMenuItem ? 1 : 0)}
|
|
|
getItemProps={getItemProps}
|
|
getItemProps={getItemProps}
|
|
|
url={`/_search?q=prefix:${currentPagePath} ${searchKeyword}`}
|
|
url={`/_search?q=prefix:${currentPagePath} ${searchKeyword}`}
|
|
|
>
|
|
>
|
|
@@ -59,7 +59,7 @@ export const SearchMethodMenuItem = (props: Props): JSX.Element => {
|
|
|
{ shouldShowMenuItem && (
|
|
{ shouldShowMenuItem && (
|
|
|
<SearchMenuItem
|
|
<SearchMenuItem
|
|
|
index={2}
|
|
index={2}
|
|
|
- highlightedIndex={highlightedIndex}
|
|
|
|
|
|
|
+ isActive={activeIndex === 2}
|
|
|
getItemProps={getItemProps}
|
|
getItemProps={getItemProps}
|
|
|
url={`/_search?q="${searchKeyword}"`}
|
|
url={`/_search?q="${searchKeyword}"`}
|
|
|
>
|
|
>
|