Skip to content

Commit

Permalink
Cleanup NcAppSidebar
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 10, 2023
1 parent 1ecae3c commit 35f4479
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/NcAppSidebar/NcAppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 || isSlotPopulated($slots['tertiary-actions']?.()),
'app-sidebar-header__desc--with-tertiary-action': canStar || hasTertiaryActions,
'app-sidebar-header__desc--editable': titleEditable && !subtitle,
'app-sidebar-header__desc--with-subtitle--editable': titleEditable && subtitle,
'app-sidebar-header__desc--without-actions': !isSlotPopulated($slots['secondary-actions']?.()),
'app-sidebar-header__desc--without-actions': !hasSecondaryActions,
}"
class="app-sidebar-header__desc">
<!-- favourite icon -->
<div v-if="canStar || isSlotPopulated($slots['tertiary-actions']?.())" class="app-sidebar-header__tertiary-actions">
<div v-if="canStar || hasTertiaryActions" 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="isSlotPopulated($slots['secondary-actions']?.())"
<NcActions v-if="hasSecondaryActions"
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="isSlotPopulated($slots['description']?.()) && !empty" class="app-sidebar-header__description">
<div v-if="hasDescription && !empty" class="app-sidebar-header__description">
<slot name="description" />
</div>
</header>
Expand Down Expand Up @@ -464,9 +464,18 @@ 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 Down

0 comments on commit 35f4479

Please sign in to comment.