File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 4141 </h4>
4242 <div class="ui attached segment repos-search">
4343 <div class="ui fluid right action left icon input" :class="{loading: isLoading}">
44- <input @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" placeholder="{{.locale.Tr "home.search_repos"}}">
44+ <input @input="changeReposFilter(reposFilter)" v-on:keyup.enter="onSearchEnter" v-on:keyup.down="onSearchDown" v-on:keyup.up="onSearchUp" v- model="searchQuery" ref="search" placeholder="{{.locale.Tr "home.search_repos"}}">
4545 <i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
4646 <div class="ui dropdown icon button" title="{{.locale.Tr "home.filter"}}">
4747 <i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
Original file line number Diff line number Diff line change @@ -189,12 +189,41 @@ function initVueComponents(app) {
189189 }
190190 } ,
191191
192+ onSearchEnter ( ) {
193+ if ( this . searchQuery . length > 0 ) {
194+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
195+ items [ this . repoIndex ] . click ( ) ;
196+ }
197+ } ,
198+
199+ onSearchDown ( ) {
200+ if ( this . repoIndex + 1 < this . repos . length ) {
201+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
202+ items [ this . repoIndex ] . classList . remove ( 'selected' ) ;
203+ this . repoIndex ++ ;
204+ items [ this . repoIndex ] . classList . add ( 'selected' ) ;
205+ }
206+ } ,
207+
208+ onSearchUp ( ) {
209+ if ( this . repoIndex > 0 ) {
210+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
211+ items [ this . repoIndex ] . classList . remove ( 'selected' ) ;
212+ this . repoIndex -- ;
213+ items [ this . repoIndex ] . classList . add ( 'selected' ) ;
214+ }
215+ } ,
216+
192217 changeReposFilter ( filter ) {
193218 this . reposFilter = filter ;
194219 this . repos = [ ] ;
195220 this . page = 1 ;
196221 this . counts [ `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
197222 this . searchRepos ( ) ;
223+ setTimeout ( ( ) => {
224+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
225+ items [ 0 ] . classList . add ( 'selected' ) ;
226+ } , 100 ) ;
198227 } ,
199228
200229 updateHistory ( ) {
Original file line number Diff line number Diff line change 178178 .star-num {
179179 font-size : 12px ;
180180 }
181+
182+ & .selected {
183+ outline : solid 1px grey ;
184+ }
181185 }
182186 }
183187 }
You can’t perform that action at this time.
0 commit comments