File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ export default function Search() {
37
37
} ,
38
38
] ) ;
39
39
const name = pkg && pkg . name ? `${ pkg . name } @${ pkg . version } ` : pkgname ;
40
+ const gotoPreview = ( ) => {
41
+ if ( value ) {
42
+ dispatch . global . update ( { showSearch : false } ) ;
43
+ navigate ( `/pkg/${ value } ` ) ;
44
+ }
45
+ }
40
46
return (
41
47
< Fragment >
42
48
< Input
@@ -47,14 +53,14 @@ export default function Search() {
47
53
onChange = { ( e ) => {
48
54
setValue ( e . target . value ) ;
49
55
} }
56
+ onKeyUp = { ( e ) => {
57
+ if ( e . key === "Enter" ) {
58
+ gotoPreview ( ) ;
59
+ }
60
+ } }
50
61
addonAfter = {
51
62
< Button
52
- onClick = { ( ) => {
53
- if ( value ) {
54
- dispatch . global . update ( { showSearch : false } ) ;
55
- navigate ( `/pkg/${ value } ` ) ;
56
- }
57
- } }
63
+ onClick = { gotoPreview }
58
64
icon = "arrow-right"
59
65
size = "small"
60
66
basic
You can’t perform that action at this time.
0 commit comments