mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
disable tabs when 0 results found
This commit is contained in:
parent
6d531c2cf8
commit
e03260d28d
@ -54,8 +54,16 @@ export default {
|
||||
},
|
||||
tabOptions() {
|
||||
return [
|
||||
{ type: 'Post', title: `${this.posts.length} Posts` },
|
||||
{ type: 'User', title: `${this.users.length} Users` },
|
||||
{
|
||||
type: 'Post',
|
||||
title: `${this.posts.length} Posts`,
|
||||
disabled: !this.posts.length,
|
||||
},
|
||||
{
|
||||
type: 'User',
|
||||
title: `${this.users.length} Users`,
|
||||
disabled: !this.users.length,
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<li
|
||||
v-for="tab in tabs"
|
||||
:key="tab.type"
|
||||
:class="[activeTab === tab.type && '--active', 'tab']"
|
||||
:class="[activeTab === tab.type && '--active', tab.disabled && '--disabled', 'tab']"
|
||||
role="button"
|
||||
@click="$emit('switchTab', tab.type)"
|
||||
>
|
||||
@ -25,6 +25,7 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.tabs {
|
||||
display: flex;
|
||||
@ -43,6 +44,13 @@ export default {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.--disabled {
|
||||
background: $background-color-disabled;
|
||||
border: 1px solid $color-neutral-80;
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&:hover:not(.--active) {
|
||||
background: $color-neutral-85;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user