Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NcAppSidebar: fix tabs with css icon #4111

Merged
merged 2 commits into from May 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/NcAppSidebar/NcAppSidebarTabs.vue
Expand Up @@ -56,7 +56,9 @@
{{ tab.name }}
</span>
<template #icon>
<NcVNodes :vnodes="tab.renderIcon()" />
<NcVNodes :vnodes="tab.renderIcon()">
<span class="app-sidebar-tabs__tab-icon" :class="tab.icon" />
</NcVNodes>
</template>
</NcCheckboxRadioSwitch>
</nav>
Expand Down Expand Up @@ -283,6 +285,13 @@ export default {
text-overflow: ellipsis;
text-align: center;
}

&-icon {
display: flex;
align-items: center;
justify-content: center;
background-size: 20px;
}
}

&__content {
Expand Down
8 changes: 3 additions & 5 deletions src/components/NcAppSidebarTab/NcAppSidebarTab.vue
Expand Up @@ -41,8 +41,6 @@
</template>

<script>
import { h } from 'vue'

export default {
name: 'NcAppSidebarTab',

Expand Down Expand Up @@ -126,12 +124,12 @@ export default {
},

/**
* Render tab's icon from slot or icon prop
* Render tab's icon slot if any
*
* @return {import('vue').VNode|import('vue').VNode[]}
* @return {import('vue').VNode[]}
*/
renderIcon() {
return this.$slots.icon || this.$scopedSlots.icon?.() || h('span', { staticClass: this.icon })
return this.$scopedSlots.icon?.()
},
},
}
Expand Down