File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import React, { useRef } from "react";
2
2
import { useSearch } from "../../theme/Root" ;
3
3
import styles from "./search.module.css" ;
4
4
5
+ const ENTER_KEY = "Enter" ;
6
+
5
7
export function Search ( { searchTags } : { searchTags : string [ ] } ) : JSX . Element {
6
8
const { setQuery } = useSearch ( ) ;
7
9
const inputRef = useRef ( null ) ;
@@ -12,7 +14,7 @@ export function Search({ searchTags }: { searchTags: string[] }): JSX.Element {
12
14
}
13
15
14
16
function handleEnter ( event ) {
15
- if ( event . key === "Enter" ) {
17
+ if ( event . key === ENTER_KEY ) {
16
18
handleSearch ( ) ;
17
19
}
18
20
}
@@ -22,7 +24,7 @@ export function Search({ searchTags }: { searchTags: string[] }): JSX.Element {
22
24
}
23
25
24
26
function handleTagEnter ( event , tag : string ) {
25
- if ( event . key === "Enter" ) {
27
+ if ( event . key === ENTER_KEY ) {
26
28
setQuery ( tag ) ;
27
29
}
28
30
}
You can’t perform that action at this time.
0 commit comments