Merge pull request #5677 from storybooks/fix/5666

CHANGE the keyboard shortcuts of toggleNav & togglePanel
This commit is contained in:
Michael Shilman 2019-02-21 14:24:28 +08:00 committed by Michael Shilman
parent 4a442cb5e0
commit 1254bdd509
5 changed files with 10 additions and 10 deletions

View File

@ -4461,7 +4461,7 @@ exports[`Storyshots UI|Settings/ShortcutsScreen default shortcuts 1`] = `
placeholder="Type keys" placeholder="Type keys"
readonly="" readonly=""
spellcheck="false" spellcheck="false"
value="S" value="A"
/> />
<svg <svg
class="emotion-16" class="emotion-16"
@ -4511,7 +4511,7 @@ exports[`Storyshots UI|Settings/ShortcutsScreen default shortcuts 1`] = `
placeholder="Type keys" placeholder="Type keys"
readonly="" readonly=""
spellcheck="false" spellcheck="false"
value="A" value="S"
/> />
<svg <svg
class="emotion-16" class="emotion-16"

View File

@ -11,14 +11,14 @@ import { Consumer } from '../core/context';
const createMenu = memoize(1)((api, shortcutKeys, isFullscreen, showPanel, showNav) => [ const createMenu = memoize(1)((api, shortcutKeys, isFullscreen, showPanel, showNav) => [
{ {
id: 'A', id: 'S',
title: 'Show sidebar', title: 'Show sidebar',
onClick: () => api.toggleNav(), onClick: () => api.toggleNav(),
right: shortcutToHumanString(shortcutKeys.toggleNav), right: shortcutToHumanString(shortcutKeys.toggleNav),
left: showNav ? <ListItemIcon icon="check" /> : <ListItemIcon />, left: showNav ? <ListItemIcon icon="check" /> : <ListItemIcon />,
}, },
{ {
id: 'S', id: 'A',
title: 'Show addons', title: 'Show addons',
onClick: () => api.togglePanel(), onClick: () => api.togglePanel(),
right: shortcutToHumanString(shortcutKeys.togglePanel), right: shortcutToHumanString(shortcutKeys.togglePanel),

View File

@ -9,9 +9,9 @@ export const controlOrMetaKey = () => (isMacLike() ? 'meta' : 'control');
export const defaultShortcuts = Object.freeze({ export const defaultShortcuts = Object.freeze({
fullScreen: ['F'], fullScreen: ['F'],
togglePanel: ['S'], // Panel visibiliy togglePanel: ['A'],
panelPosition: ['D'], panelPosition: ['D'],
toggleNav: ['A'], toggleNav: ['S'],
toolbar: ['T'], toolbar: ['T'],
search: ['/'], search: ['/'],
focusNav: ['1'], focusNav: ['1'],

View File

@ -28,7 +28,7 @@ describe('shortcuts api', () => {
store.setState(state); store.setState(state);
expect(api.getShortcutKeys().fullScreen).toEqual(['Z']); expect(api.getShortcutKeys().fullScreen).toEqual(['Z']);
expect(api.getShortcutKeys().togglePanel).toEqual(['S']); expect(api.getShortcutKeys().togglePanel).toEqual(['A']);
}); });
it('sets defaults, ignoring anything persisted that is out of date', () => { it('sets defaults, ignoring anything persisted that is out of date', () => {
@ -61,7 +61,7 @@ describe('shortcuts api', () => {
await api.setShortcut('togglePanel', ['B']); await api.setShortcut('togglePanel', ['B']);
await api.restoreAllDefaultShortcuts(); await api.restoreAllDefaultShortcuts();
expect(api.getShortcutKeys().fullScreen).toEqual(['F']); expect(api.getShortcutKeys().fullScreen).toEqual(['F']);
expect(api.getShortcutKeys().togglePanel).toEqual(['S']); expect(api.getShortcutKeys().togglePanel).toEqual(['A']);
}); });
it('restores single default', async () => { it('restores single default', async () => {

View File

@ -8,8 +8,8 @@ import ShortcutsScreen from './shortcuts';
// A limited set of keys we use in this test file // A limited set of keys we use in this test file
const shortcutKeys = { const shortcutKeys = {
fullScreen: ['F'], fullScreen: ['F'],
togglePanel: ['S'], togglePanel: ['A'],
toggleNav: ['A'], toggleNav: ['S'],
toolbar: ['T'], toolbar: ['T'],
search: ['/'], search: ['/'],
focusNav: ['1'], focusNav: ['1'],