Skip to content

Commit

Permalink
Fix NcAppSidebar reactivity
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
raimund-schluessler committed Feb 12, 2023
1 parent a17ea96 commit 8b0d807
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/components/NcAppSidebar/NcAppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ include a standard-header like it's used by the files app.
@after-leave="onAfterLeave">
<aside id="app-sidebar-vue" class="app-sidebar">
<header :class="{
'app-sidebar-header--with-figure': hasFigure,
'app-sidebar-header--with-figure': isSlotPopulated($slots?.header?.()) || background,
'app-sidebar-header--compact': compact,
}"
class="app-sidebar-header">
<!-- container for figure and description, allows easy switching to compact mode -->
<div class="app-sidebar-header__info">
<!-- sidebar header illustration/figure -->
<div v-if="hasFigure && !empty"
<div v-if="(isSlotPopulated($slots?.header?.()) || background) && !empty"
:class="{
'app-sidebar-header__figure--with-action': hasFigureClickListener
}"
Expand All @@ -182,14 +182,14 @@ include a standard-header like it's used by the files app.
<!-- sidebar details -->
<div v-if="!empty"
:class="{
'app-sidebar-header__desc--with-tertiary-action': canStar || hasTertiaryActions,
'app-sidebar-header__desc--with-tertiary-action': canStar || isSlotPopulated($slots?.['tertiary-actions']?.()),
'app-sidebar-header__desc--editable': titleEditable && !subtitle,
'app-sidebar-header__desc--with-subtitle--editable': titleEditable && subtitle,
'app-sidebar-header__desc--without-actions': !hasSecondaryActions,
'app-sidebar-header__desc--without-actions': !isSlotPopulated($slots?.['secondary-actions']?.()),
}"
class="app-sidebar-header__desc">
<!-- favourite icon -->
<div v-if="canStar || hasTertiaryActions" class="app-sidebar-header__tertiary-actions">
<div v-if="canStar || isSlotPopulated($slots?.['tertiary-actions']?.())" class="app-sidebar-header__tertiary-actions">
<slot name="tertiary-actions">
<NcButton v-if="canStar"
:aria-label="favoriteTranslated"
Expand Down Expand Up @@ -240,7 +240,7 @@ include a standard-header like it's used by the files app.
</form>
</template>
<!-- header main menu -->
<NcActions v-if="hasSecondaryActions"
<NcActions v-if="isSlotPopulated($slots?.['secondary-actions']?.())"
class="app-sidebar-header__menu"
:force-menu="forceMenu">
<slot name="secondary-actions" />
Expand All @@ -267,7 +267,7 @@ include a standard-header like it's used by the files app.
</template>
</NcButton>
<div v-if="hasDescription && !empty" class="app-sidebar-header__description">
<div v-if="isSlotPopulated($slots?.description?.()) && !empty" class="app-sidebar-header__description">
<slot name="description" />
</div>
</header>
Expand Down Expand Up @@ -464,18 +464,6 @@ export default {
canStar() {
return this.isStarred !== null
},
hasDescription() {
return isSlotPopulated(this.$slots?.description?.())
},
hasFigure() {
return isSlotPopulated(this.$slots?.header?.()) || this.background
},
hasSecondaryActions() {
return isSlotPopulated(this.$slots?.['secondary-actions']?.())
},
hasTertiaryActions() {
return isSlotPopulated(this.$slots?.['tertiary-actions']?.())
},
hasFigureClickListener() {
return this.$attrs['figure-click']
},
Expand All @@ -493,6 +481,8 @@ export default {
},
methods: {
isSlotPopulated,
onBeforeEnter(element) {
/**
* The sidebar is opening and the transition is in progress
Expand Down

0 comments on commit 8b0d807

Please sign in to comment.