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() {
3737 } ,
3838 ] ) ;
3939 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+ }
4046 return (
4147 < Fragment >
4248 < Input
@@ -47,14 +53,14 @@ export default function Search() {
4753 onChange = { ( e ) => {
4854 setValue ( e . target . value ) ;
4955 } }
56+ onKeyUp = { ( e ) => {
57+ if ( e . key === "Enter" ) {
58+ gotoPreview ( ) ;
59+ }
60+ } }
5061 addonAfter = {
5162 < Button
52- onClick = { ( ) => {
53- if ( value ) {
54- dispatch . global . update ( { showSearch : false } ) ;
55- navigate ( `/pkg/${ value } ` ) ;
56- }
57- } }
63+ onClick = { gotoPreview }
5864 icon = "arrow-right"
5965 size = "small"
6066 basic
You can’t perform that action at this time.
0 commit comments