Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/AppSidebar/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@
</div>
</header>

<AppSidebarTabs ref="tabs" :active="active" @update:active="onUpdateActive">
<AppSidebarTabs v-show="!loading"
ref="tabs"
:active="active"
@update:active="onUpdateActive">
<slot />
</AppSidebarTabs>

<EmptyContent v-if="loading" icon="icon-loading" />
</aside>
</transition>
</template>
Expand All @@ -231,6 +236,7 @@ import Focus from '../../directives/Focus'
import Linkify from '../../directives/Linkify'
import l10n from '../../mixins/l10n'
import AppSidebarTabs from './AppSidebarTabs'
import EmptyContent from '../EmptyContent/EmptyContent'
import { directive as ClickOutside } from 'v-click-outside'

export default {
Expand All @@ -239,6 +245,7 @@ export default {
components: {
Actions,
AppSidebarTabs,
EmptyContent,
},

directives: {
Expand Down Expand Up @@ -300,6 +307,13 @@ export default {
type: Boolean,
default: false,
},
/**
* Show loading spinner instead of tabs
*/
loading: {
type: Boolean,
default: false,
},

/**
* Display the sidebar in compact mode
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppSidebar/AppSidebarTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!-- tabs content -->
<div :class="{'app-sidebar-tabs__content--multiple': hasMultipleTabs}"
class="app-sidebar-tabs__content">
<slot :active-tab="activeTab" />
<slot />
</div>
</div>
</template>
Expand Down
11 changes: 9 additions & 2 deletions src/components/AppSidebarTab/AppSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html -->

<template>
<section v-show="isActive"
<section
:id="`tab-${id}`"
:class="{'app-sidebar__tab--active': isActive}"
:aria-hidden="!isActive"
:aria-labelledby="name"
class="app-sidebar__tab"
tabindex="0"
role="tabpanel">
<slot />
Expand Down Expand Up @@ -67,7 +69,8 @@ export default {
</script>

<style lang="scss" scoped>
section {
.app-sidebar__tab {
display: none;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving this to the css, we allow to use v-show on the AppSidebarTab as well, otherwise it was conflicting as we'd have two handlers, from the inside and from the outside.

padding: 10px;
min-height: 100%; // fill available height

Expand All @@ -76,5 +79,9 @@ section {
box-shadow: 0 0 0.2em var(--color-primary);
outline: 0;
}

&--active {
display: block;
}
}
</style>