1- import React , { useEffect , useRef , useState } from 'react' ;
2- import { useCookie } from './Storage' ;
1+ import React , { useRef , useState } from 'react' ;
2+ import { useSearchRealm } from '../finder /Storage' ;
33import DropDownMenu from './DropDownMenu' ;
44import SearchIcon from 'icons/search.svg' ;
55
6- const useSearchRealm = initial => useCookie ( 'django-finder-search-realm' , initial ) ;
7-
86
97function useSearchParam ( key ) : [ string , ( value : string ) => any ] {
108 const params = new URLSearchParams ( window . location . search ) ;
@@ -80,7 +78,14 @@ export function SearchField(props) {
8078 }
8179
8280 return ( < >
83- < input ref = { searchRef } type = "search" defaultValue = { searchQuery } placeholder = { gettext ( "Search for …" ) } onChange = { handleSearch } onKeyDown = { handleSearch } />
81+ < input
82+ ref = { searchRef }
83+ type = "search"
84+ defaultValue = { searchQuery }
85+ placeholder = { gettext ( "Search for …" ) }
86+ onChange = { handleSearch }
87+ onKeyDown = { handleSearch }
88+ />
8489 < div >
8590 < span className = "search-icon" onClick = { handleSearch } > < SearchIcon /> </ span >
8691 < DropDownMenu wrapperElement = "span" className = "search-realm with-caret" tooltip = { gettext ( "Restrict search" ) } >
@@ -90,6 +95,7 @@ export function SearchField(props) {
9095 < li onClick = { ( ) => changeSearchRealm ( 'everywhere' ) }
9196 className = { isActive ( 'everywhere' ) } > { gettext ( "In all folders" ) }
9297 </ li >
98+ < hr />
9399 < li onClick = { ( ) => changeSearchRealm ( 'filename' ) }
94100 className = { isActive ( 'filename' ) } > { gettext ( "Filename only" ) }
95101 </ li >
0 commit comments