debian-mirror-gitlab/app/assets/javascripts/super_sidebar/components/super_sidebar.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
2.7 KiB
Vue
Raw Normal View History

2023-03-17 16:20:25 +05:30
<script>
2023-05-27 22:25:52 +05:30
import { GlButton, GlCollapse } from '@gitlab/ui';
import { __ } from '~/locale';
import { isCollapsed, toggleSuperSidebarCollapsed } from '../super_sidebar_collapsed_state_manager';
2023-03-17 16:20:25 +05:30
import UserBar from './user_bar.vue';
2023-05-27 22:25:52 +05:30
import SidebarPortalTarget from './sidebar_portal_target.vue';
2023-03-17 16:20:25 +05:30
import ContextSwitcherToggle from './context_switcher_toggle.vue';
import ContextSwitcher from './context_switcher.vue';
2023-04-23 21:23:45 +05:30
import HelpCenter from './help_center.vue';
2023-05-27 22:25:52 +05:30
import SidebarMenu from './sidebar_menu.vue';
2023-03-17 16:20:25 +05:30
export default {
components: {
2023-05-27 22:25:52 +05:30
GlButton,
2023-03-17 16:20:25 +05:30
GlCollapse,
UserBar,
ContextSwitcherToggle,
ContextSwitcher,
2023-04-23 21:23:45 +05:30
HelpCenter,
2023-05-27 22:25:52 +05:30
SidebarMenu,
SidebarPortalTarget,
},
i18n: {
skipToMainContent: __('Skip to main content'),
2023-03-17 16:20:25 +05:30
},
props: {
sidebarData: {
type: Object,
required: true,
},
},
data() {
return {
contextSwitcherOpened: false,
2023-05-27 22:25:52 +05:30
isCollapased: isCollapsed(),
2023-03-17 16:20:25 +05:30
};
},
2023-05-27 22:25:52 +05:30
computed: {
menuItems() {
return this.sidebarData.current_menu_items || [];
},
},
methods: {
collapseSidebar() {
toggleSuperSidebarCollapsed(true, false);
},
},
2023-03-17 16:20:25 +05:30
};
</script>
<template>
2023-05-27 22:25:52 +05:30
<div>
<div class="super-sidebar-overlay" @click="collapseSidebar"></div>
<aside
id="super-sidebar"
:aria-hidden="String(isCollapased)"
class="super-sidebar"
data-testid="super-sidebar"
data-qa-selector="navbar"
:inert="isCollapased"
tabindex="-1"
>
<gl-button
class="super-sidebar-skip-to gl-sr-only-focusable gl-absolute gl-left-3 gl-right-3 gl-top-3"
href="#content-body"
variant="confirm"
>
{{ $options.i18n.skipToMainContent }}
</gl-button>
<user-bar :sidebar-data="sidebarData" />
<div class="gl-display-flex gl-flex-direction-column gl-flex-grow-1 gl-overflow-hidden">
<div class="gl-flex-grow-1 gl-overflow-auto">
<context-switcher-toggle
:context="sidebarData.current_context_header"
:expanded="contextSwitcherOpened"
/>
<gl-collapse id="context-switcher" v-model="contextSwitcherOpened">
<context-switcher
:username="sidebarData.username"
:projects-path="sidebarData.projects_path"
:groups-path="sidebarData.groups_path"
:current-context="sidebarData.current_context"
/>
</gl-collapse>
<gl-collapse :visible="!contextSwitcherOpened">
<sidebar-menu :items="menuItems" />
<sidebar-portal-target />
</gl-collapse>
</div>
<div class="gl-p-3">
<help-center :sidebar-data="sidebarData" />
</div>
2023-03-17 16:20:25 +05:30
</div>
2023-05-27 22:25:52 +05:30
</aside>
</div>
2023-03-17 16:20:25 +05:30
</template>