| 
 | 1 | +<script>  | 
 | 2 | +import {  | 
 | 3 | +  GlTooltipDirective,  | 
 | 4 | +  GlBadge,  | 
 | 5 | +  GlButtonGroup,  | 
 | 6 | +  GlButton,  | 
 | 7 | +  GlSearchBoxByType,  | 
 | 8 | +} from '@gitlab/ui';  | 
 | 9 | +import { getModifierKey } from '~/constants';  | 
 | 10 | +import { __, s__, sprintf } from '~/locale';  | 
 | 11 | +
  | 
 | 12 | +export default {  | 
 | 13 | +  i18n: {  | 
 | 14 | +    listViewToggleTitle: __('List view'),  | 
 | 15 | +    treeViewToggleTitle: __('Tree view'),  | 
 | 16 | +  },  | 
 | 17 | +  directives: {  | 
 | 18 | +    GlTooltip: GlTooltipDirective,  | 
 | 19 | +  },  | 
 | 20 | +  components: {  | 
 | 21 | +    GlBadge,  | 
 | 22 | +    GlButtonGroup,  | 
 | 23 | +    GlButton,  | 
 | 24 | +    GlSearchBoxByType,  | 
 | 25 | +  },  | 
 | 26 | +  props: {  | 
 | 27 | +    totalFilesCount: {  | 
 | 28 | +      type: Number,  | 
 | 29 | +      required: true,  | 
 | 30 | +    },  | 
 | 31 | +  },  | 
 | 32 | +  data() {  | 
 | 33 | +    return {  | 
 | 34 | +      search: '',  | 
 | 35 | +      renderTreeList: false,  | 
 | 36 | +    };  | 
 | 37 | +  },  | 
 | 38 | +  searchPlaceholder: sprintf(s__('Repository|Search (e.g. *.vue) (%{modifierKey}P)'), {  | 
 | 39 | +    modifierKey: getModifierKey(),  | 
 | 40 | +  }),  | 
 | 41 | +};  | 
 | 42 | +</script>  | 
 | 43 | + | 
 | 44 | +<template>  | 
 | 45 | +  <div class="tree-list-holder">  | 
 | 46 | +    <div class="gl-mb-3 gl-flex gl-items-center">  | 
 | 47 | +      <h5 class="gl-my-0 gl-inline-block">{{ __('Files') }}</h5>  | 
 | 48 | +      <gl-badge class="gl-ml-2">{{ totalFilesCount }}</gl-badge>  | 
 | 49 | +      <gl-button-group class="gl-ml-auto">  | 
 | 50 | +        <gl-button  | 
 | 51 | +          v-gl-tooltip.hover  | 
 | 52 | +          icon="list-bulleted"  | 
 | 53 | +          :selected="!renderTreeList"  | 
 | 54 | +          :title="$options.i18n.listViewToggleTitle"  | 
 | 55 | +          :aria-label="$options.i18n.listViewToggleTitle"  | 
 | 56 | +          @click="renderTreeList = false"  | 
 | 57 | +        />  | 
 | 58 | +        <gl-button  | 
 | 59 | +          v-gl-tooltip.hover  | 
 | 60 | +          icon="file-tree"  | 
 | 61 | +          :selected="renderTreeList"  | 
 | 62 | +          :title="$options.i18n.treeViewToggleTitle"  | 
 | 63 | +          :aria-label="$options.i18n.treeViewToggleTitle"  | 
 | 64 | +          @click="renderTreeList = true"  | 
 | 65 | +        />  | 
 | 66 | +      </gl-button-group>  | 
 | 67 | +    </div>  | 
 | 68 | +    <label for="repository-tree-search" class="sr-only">{{ $options.searchPlaceholder }}</label>  | 
 | 69 | +    <gl-search-box-by-type  | 
 | 70 | +      id="repository-tree-search"  | 
 | 71 | +      v-model="search"  | 
 | 72 | +      :placeholder="$options.searchPlaceholder"  | 
 | 73 | +      :clear-button-title="__('Clear search')"  | 
 | 74 | +      name="repository-tree-search"  | 
 | 75 | +      class="gl-mb-3"  | 
 | 76 | +    />  | 
 | 77 | +    <div>  | 
 | 78 | +      <!-- TODO: implement recycle-scroller + list files (file-row components) -->  | 
 | 79 | +      <p class="text-center gl-my-6">  | 
 | 80 | +        {{ __('No files found') }}  | 
 | 81 | +      </p>  | 
 | 82 | +    </div>  | 
 | 83 | +  </div>  | 
 | 84 | +</template>  | 
0 commit comments