@@ -45,8 +45,10 @@ class ComponentViewer extends Component<Props, ComponentViewerState> {
4545 this . state = this . stateFromUrl ( ) ;
4646 this . hotKeyBoundActions = {
4747 'Alt F' : this . onFullScreenToggle ,
48- 'Alt Down' : this . onNextDemo ,
49- 'Alt Up' : this . onPrevDemo ,
48+ 'Ctrl Alt Down' : this . onNextDemo ,
49+ 'Ctrl Alt Up' : this . onPrevDemo ,
50+ 'Ctrl Alt Right' : this . onNextDemoEntry ,
51+ 'Ctrl Alt Left' : this . onPrevDemoEntry ,
5052 ...this . dropDownKeyBoundActions ( )
5153 } ;
5254 }
@@ -220,6 +222,18 @@ class ComponentViewer extends Component<Props, ComponentViewerState> {
220222 } ) ) ;
221223 }
222224
225+ private onNextDemoEntry = ( ) => {
226+ this . withRegistryAndDemoAndTitleWhenPresent ( ( ( registry , demo , title ) => {
227+ this . selectInstanceByTitle ( demo . findNextInstanceByCurrentTitle ( title ) . title ) ;
228+ } ) ) ;
229+ }
230+
231+ private onPrevDemoEntry = ( ) => {
232+ this . withRegistryAndDemoAndTitleWhenPresent ( ( ( registry , demo , title ) => {
233+ this . selectInstanceByTitle ( demo . findPrevInstanceByCurrentTitle ( title ) . title ) ;
234+ } ) ) ;
235+ }
236+
223237 private withRegistryAndDemoNameWhenPresent = ( code : ( registry : Registry , demoName : string ) => void ) => {
224238 const registry = this . findSelectedRegistry ( ) ;
225239 const { demoName} = this . state ;
@@ -231,6 +245,20 @@ class ComponentViewer extends Component<Props, ComponentViewerState> {
231245 code ( registry , demoName ) ;
232246 }
233247
248+ private withRegistryAndDemoAndTitleWhenPresent = (
249+ code : ( registry : Registry , demo : DemoEntry , title : string ) => void
250+ ) => {
251+ this . withRegistryAndDemoNameWhenPresent ( ( ( registry , demoName ) => {
252+ const demo = registry . findDemoByName ( demoName ) ;
253+ if ( ! demo ) {
254+ return ;
255+ }
256+
257+ const { entryTitle} = this . state ;
258+ code ( registry , demo , entryTitle ) ;
259+ } ) ) ;
260+ }
261+
234262 private selectRegistry = ( registryName : string ) => {
235263 this . pushUrl (
236264 registryName ,
0 commit comments