moved keycodes constants to common lib file

updated markup to use buttons instead of links
This commit is contained in:
Phil Hughes 2018-04-19 12:04:49 +01:00
parent f1719de385
commit aadde87f42
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F
6 changed files with 16 additions and 13 deletions

View file

@ -8,11 +8,13 @@ import {
MAX_FILE_FINDER_RESULTS, MAX_FILE_FINDER_RESULTS,
FILE_FINDER_ROW_HEIGHT, FILE_FINDER_ROW_HEIGHT,
FILE_FINDER_EMPTY_ROW_HEIGHT, FILE_FINDER_EMPTY_ROW_HEIGHT,
} from '../../constants';
import {
UP_KEY_CODE, UP_KEY_CODE,
DOWN_KEY_CODE, DOWN_KEY_CODE,
ENTER_KEY_CODE, ENTER_KEY_CODE,
ESC_KEY_CODE, ESC_KEY_CODE,
} from '../../constants'; } from '../../../lib/utils/keycodes';
export default { export default {
components: { components: {
@ -191,7 +193,7 @@ export default {
></i> ></i>
<i <i
role="button" role="button"
aria-hidden="true" :aria-label="__('Clear search input')"
class="fa fa-times dropdown-input-clear" class="fa fa-times dropdown-input-clear"
:class="{ :class="{
show: showClearInputButton show: showClearInputButton
@ -225,16 +227,16 @@ export default {
</template> </template>
<li <li
v-else v-else
class="dropdown-menu-empty-itemhidden" class="dropdown-menu-empty-item"
> >
<a href="#"> <div class="append-right-default prepend-left-default prepend-top-8 append-bottom-8">
<template v-if="loading"> <template v-if="loading">
{{ __('Loading...') }} {{ __('Loading...') }}
</template> </template>
<template v-else> <template v-else>
{{ __('No files found.') }} {{ __('No files found.') }}
</template> </template>
</a> </div>
</li> </li>
</virtual-list> </virtual-list>
</div> </div>

View file

@ -58,8 +58,8 @@ export default {
</script> </script>
<template> <template>
<a <button
href="#" type="button"
class="diff-changed-file" class="diff-changed-file"
:class="{ :class="{
'is-focused': focused, 'is-focused': focused,
@ -109,5 +109,5 @@ export default {
:file="file" :file="file"
/> />
</span> </span>
</a> </button>
</template> </template>

View file

@ -2,10 +2,6 @@
export const MAX_FILE_FINDER_RESULTS = 40; export const MAX_FILE_FINDER_RESULTS = 40;
export const FILE_FINDER_ROW_HEIGHT = 55; export const FILE_FINDER_ROW_HEIGHT = 55;
export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33; export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33;
export const UP_KEY_CODE = 38;
export const DOWN_KEY_CODE = 40;
export const ENTER_KEY_CODE = 13;
export const ESC_KEY_CODE = 27;
// Commit message textarea // Commit message textarea
export const MAX_TITLE_LENGTH = 50; export const MAX_TITLE_LENGTH = 50;

View file

@ -0,0 +1,4 @@
export const UP_KEY_CODE = 38;
export const DOWN_KEY_CODE = 40;
export const ENTER_KEY_CODE = 13;
export const ESC_KEY_CODE = 27;

View file

@ -472,6 +472,7 @@ img.emoji {
.append-right-20 { margin-right: 20px; } .append-right-20 { margin-right: 20px; }
.append-bottom-0 { margin-bottom: 0; } .append-bottom-0 { margin-bottom: 0; }
.append-bottom-5 { margin-bottom: 5px; } .append-bottom-5 { margin-bottom: 5px; }
.append-bottom-8 { margin-bottom: $grid-size; }
.append-bottom-10 { margin-bottom: 10px; } .append-bottom-10 { margin-bottom: 10px; }
.append-bottom-15 { margin-bottom: 15px; } .append-bottom-15 { margin-bottom: 15px; }
.append-bottom-20 { margin-bottom: 20px; } .append-bottom-20 { margin-bottom: 20px; }

View file

@ -1,7 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
import store from '~/ide/stores'; import store from '~/ide/stores';
import FindFileComponent from '~/ide/components/file_finder/index.vue'; import FindFileComponent from '~/ide/components/file_finder/index.vue';
import { UP_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESC_KEY_CODE } from '~/ide/constants'; import { UP_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESC_KEY_CODE } from '~/lib/utils/keycodes';
import router from '~/ide/ide_router'; import router from '~/ide/ide_router';
import { file, resetStore } from '../../helpers'; import { file, resetStore } from '../../helpers';
import { mountComponentWithStore } from '../../../helpers/vue_mount_component_helper'; import { mountComponentWithStore } from '../../../helpers/vue_mount_component_helper';