Skip to content

Commit f8ee0c5

Browse files
authored
Merge pull request #1429 from nextcloud/fix/app-sidebar
Add loading state on AppSidebar and remove unwanted slot bind
2 parents 86eff4c + 992d7be commit f8ee0c5

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

src/components/AppSidebar/AppSidebar.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,14 @@
218218
</div>
219219
</header>
220220

221-
<AppSidebarTabs ref="tabs" :active="active" @update:active="onUpdateActive">
221+
<AppSidebarTabs v-show="!loading"
222+
ref="tabs"
223+
:active="active"
224+
@update:active="onUpdateActive">
222225
<slot />
223226
</AppSidebarTabs>
227+
228+
<EmptyContent v-if="loading" icon="icon-loading" />
224229
</aside>
225230
</transition>
226231
</template>
@@ -231,6 +236,7 @@ import Focus from '../../directives/Focus'
231236
import Linkify from '../../directives/Linkify'
232237
import l10n from '../../mixins/l10n'
233238
import AppSidebarTabs from './AppSidebarTabs'
239+
import EmptyContent from '../EmptyContent/EmptyContent'
234240
import { directive as ClickOutside } from 'v-click-outside'
235241
236242
export default {
@@ -239,6 +245,7 @@ export default {
239245
components: {
240246
Actions,
241247
AppSidebarTabs,
248+
EmptyContent,
242249
},
243250
244251
directives: {
@@ -300,6 +307,13 @@ export default {
300307
type: Boolean,
301308
default: false,
302309
},
310+
/**
311+
* Show loading spinner instead of tabs
312+
*/
313+
loading: {
314+
type: Boolean,
315+
default: false,
316+
},
303317
304318
/**
305319
* Display the sidebar in compact mode

src/components/AppSidebar/AppSidebarTabs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<!-- tabs content -->
5555
<div :class="{'app-sidebar-tabs__content--multiple': hasMultipleTabs}"
5656
class="app-sidebar-tabs__content">
57-
<slot :active-tab="activeTab" />
57+
<slot />
5858
</div>
5959
</div>
6060
</template>

src/components/AppSidebarTab/AppSidebarTab.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html -->
2525

2626
<template>
27-
<section v-show="isActive"
27+
<section
2828
:id="`tab-${id}`"
29+
:class="{'app-sidebar__tab--active': isActive}"
2930
:aria-hidden="!isActive"
3031
:aria-labelledby="name"
32+
class="app-sidebar__tab"
3133
tabindex="0"
3234
role="tabpanel">
3335
<slot />
@@ -67,7 +69,8 @@ export default {
6769
</script>
6870

6971
<style lang="scss" scoped>
70-
section {
72+
.app-sidebar__tab {
73+
display: none;
7174
padding: 10px;
7275
min-height: 100%; // fill available height
7376
@@ -76,5 +79,9 @@ section {
7679
box-shadow: 0 0 0.2em var(--color-primary);
7780
outline: 0;
7881
}
82+
83+
&--active {
84+
display: block;
85+
}
7986
}
8087
</style>

0 commit comments

Comments
 (0)