summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/super_sidebar/components/context_switcher.vue
blob: f1ddb8290a05720d2fee371d6bdf103b02aae035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<script>
import { GlAvatar, GlSearchBoxByType } from '@gitlab/ui';
import { s__ } from '~/locale';
import { contextSwitcherItems } from '../mock_data';
import NavItem from './nav_item.vue';

export default {
  components: {
    GlAvatar,
    GlSearchBoxByType,
    NavItem,
  },
  i18n: {
    contextNavigation: s__('Navigation|Context navigation'),
    switchTo: s__('Navigation|Switch to...'),
    recentProjects: s__('Navigation|Recent projects'),
    recentGroups: s__('Navigation|Recent groups'),
  },
  contextSwitcherItems,
  viewAllProjectsItem: {
    title: s__('Navigation|View all projects'),
    link: '/projects',
    icon: 'project',
  },
  viewAllGroupsItem: {
    title: s__('Navigation|View all groups'),
    link: '/groups',
    icon: 'group',
  },
};
</script>

<template>
  <div>
    <gl-search-box-by-type />
    <nav :aria-label="$options.i18n.contextNavigation">
      <ul class="gl-p-0 gl-list-style-none">
        <li>
          <div aria-hidden="true" class="gl-font-weight-bold gl-px-3 gl-py-3">
            {{ $options.i18n.switchTo }}
          </div>
          <ul :aria-label="$options.i18n.switchTo" class="gl-p-0">
            <nav-item :item="$options.contextSwitcherItems.yourWork" />
          </ul>
        </li>
        <li>
          <div aria-hidden="true" class="gl-font-weight-bold gl-px-3 gl-py-3">
            {{ $options.i18n.recentProjects }}
          </div>
          <ul :aria-label="$options.i18n.recentProjects" class="gl-p-0">
            <nav-item
              v-for="project in $options.contextSwitcherItems.recentProjects"
              :key="project.title"
              :item="project"
            >
              <template #icon>
                <gl-avatar shape="rect" :size="32" :src="project.avatar" />
              </template>
            </nav-item>
            <nav-item :item="$options.viewAllProjectsItem" />
          </ul>
        </li>
        <li>
          <div aria-hidden="true" class="gl-font-weight-bold gl-px-3 gl-py-3">
            {{ $options.i18n.recentGroups }}
          </div>
          <ul :aria-label="$options.i18n.recentGroups" class="gl-p-0">
            <nav-item
              v-for="project in $options.contextSwitcherItems.recentGroups"
              :key="project.title"
              :item="project"
            >
              <template #icon>
                <gl-avatar shape="rect" :size="32" :src="project.avatar" />
              </template>
            </nav-item>
            <nav-item :item="$options.viewAllGroupsItem" />
          </ul>
        </li>
      </ul>
    </nav>
  </div>
</template>