Commit b867b33e authored by Phil Hughes's avatar Phil Hughes

moved CSS into SCSS file

added ellipsis to path but not name
parent a3566506
...@@ -5,7 +5,7 @@ import VirtualList from 'vue-virtual-scroll-list'; ...@@ -5,7 +5,7 @@ import VirtualList from 'vue-virtual-scroll-list';
import Item from './item.vue'; import Item from './item.vue';
import router from '../../ide_router'; import router from '../../ide_router';
const MAX_RESULTS = 20; const MAX_RESULTS = 40;
export default { export default {
components: { components: {
...@@ -48,16 +48,14 @@ export default { ...@@ -48,16 +48,14 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if (!this.fileFindVisible) { if (!this.fileFindVisible) {
this.searchText = ''; this.searchText = '';
this.focusedIndex = 0;
} else { } else {
this.focusedIndex = 0;
this.$refs.searchInput.focus(); this.$refs.searchInput.focus();
} }
}); });
}, },
searchText() { searchText() {
if (this.searchText.trim() !== '') { this.focusedIndex = 0;
this.focusedIndex = 0;
}
}, },
}, },
methods: { methods: {
...@@ -103,7 +101,7 @@ export default { ...@@ -103,7 +101,7 @@ export default {
<template> <template>
<div <div
class="ide-file-finder-overlay" class="ide-file-finder-overlay"
@click.self="toggleFileFinder(false)" @mousedown.self="toggleFileFinder(false)"
> >
<div <div
class="dropdown-menu diff-file-changes ide-file-finder show" class="dropdown-menu diff-file-changes ide-file-finder show"
...@@ -112,7 +110,7 @@ export default { ...@@ -112,7 +110,7 @@ export default {
<input <input
type="search" type="search"
class="dropdown-input-field" class="dropdown-input-field"
placeholder="Search files" :placeholder="__('Search files')"
autocomplete="off" autocomplete="off"
v-model="searchText" v-model="searchText"
ref="searchInput" ref="searchInput"
...@@ -150,10 +148,10 @@ export default { ...@@ -150,10 +148,10 @@ export default {
> >
<a href=""> <a href="">
<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> </a>
</li> </li>
...@@ -162,20 +160,3 @@ export default { ...@@ -162,20 +160,3 @@ export default {
</div> </div>
</div> </div>
</template> </template>
<style>
.ide-file-finder-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100;
}
.ide-file-finder {
top: 10px;
left: 50%;
transform: translateX(-50%);
}
</style>
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import fuzzaldrinPlus from 'fuzzaldrin-plus'; import fuzzaldrinPlus from 'fuzzaldrin-plus';
import FileIcon from '../../../vue_shared/components/file_icon.vue'; import FileIcon from '../../../vue_shared/components/file_icon.vue';
const MAX_PATH_LENGTH = 60;
export default { export default {
components: { components: {
FileIcon, FileIcon,
...@@ -24,10 +26,14 @@ export default { ...@@ -24,10 +26,14 @@ export default {
clickRow() { clickRow() {
this.$emit('click', this.file); this.$emit('click', this.file);
}, },
highlightText(text) { highlightText(text, addEllipsis) {
const occurrences = fuzzaldrinPlus.match(text, this.searchText); const maxText =
text.length < MAX_PATH_LENGTH || !addEllipsis
? text
: `...${text.substr(text.length - MAX_PATH_LENGTH)}`;
const occurrences = fuzzaldrinPlus.match(maxText, this.searchText);
return text return maxText
.split('') .split('')
.map( .map(
(char, i) => (char, i) =>
...@@ -56,21 +62,14 @@ export default { ...@@ -56,21 +62,14 @@ export default {
<span class="diff-changed-file-content append-right-8"> <span class="diff-changed-file-content append-right-8">
<strong <strong
class="diff-changed-file-name" class="diff-changed-file-name"
v-html="highlightText(file.name)" v-html="highlightText(file.name, false)"
> >
</strong> </strong>
<span <span
class="diff-changed-file-path prepend-top-5" class="diff-changed-file-path prepend-top-5"
v-html="highlightText(file.path)" v-html="highlightText(file.path, true)"
> >
</span> </span>
</span> </span>
</a> </a>
</template> </template>
<style>
.highlighted {
color: #1b69b6;
font-weight: 600;
}
</style>
...@@ -200,13 +200,14 @@ export default class Editor { ...@@ -200,13 +200,14 @@ export default class Editor {
const getKeyCode = key => { const getKeyCode = key => {
const monacoKeyMod = key.indexOf('KEY_') === 0; const monacoKeyMod = key.indexOf('KEY_') === 0;
return monacoKeyMod ? monaco.KeyCode[key] : monaco.KeyMod[key]; return monacoKeyMod ? this.monaco.KeyCode[key] : this.monaco.KeyMod[key];
}; };
keymap.forEach(command => { keymap.forEach(command => {
const keybindings = command.bindings.map(binding => { const keybindings = command.bindings.map(binding => {
const keys = binding.split('+'); const keys = binding.split('+');
// eslint-disable-next-line no-bitwise
return keys.length > 1 ? getKeyCode(keys[0]) | getKeyCode(keys[1]) : getKeyCode(keys[0]); return keys.length > 1 ? getKeyCode(keys[0]) | getKeyCode(keys[1]) : getKeyCode(keys[0]);
}); });
......
...@@ -840,3 +840,23 @@ ...@@ -840,3 +840,23 @@
align-items: center; align-items: center;
font-weight: $gl-font-weight-bold; font-weight: $gl-font-weight-bold;
} }
.ide-file-finder-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100;
}
.ide-file-finder {
top: 10px;
left: 50%;
transform: translateX(-50%);
.highlighted {
color: $blue-500;
font-weight: $gl-font-weight-bold;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment