Review: add hasMore() computed value +

Replacing varying conditions for same
  logic with computed value `hasMore`.
This commit is contained in:
Raphael Beer 2020-04-09 23:52:12 +02:00
parent b3f1137006
commit e018e2ead9
No known key found for this signature in database
GPG Key ID: C1AC5E018B25EF11

View File

@ -13,7 +13,7 @@
/> />
</div> </div>
<base-button <base-button
v-if="allConnectionsCount - connections.length" v-if="hasMore"
:loading="loading" :loading="loading"
class="spacer-x-small" class="spacer-x-small"
size="small" size="small"
@ -26,7 +26,7 @@
}} }}
</base-button> </base-button>
<ds-input <ds-input
v-if="connections.length > 7" v-if="!hasMore"
v-focus="true" v-focus="true"
:name="`${type}Filter`" :name="`${type}Filter`"
:placeholder="filter" :placeholder="filter"
@ -70,9 +70,11 @@ export default {
connections() { connections() {
return this.user[this.type] return this.user[this.type]
}, },
hasMore() {
return this.allConnectionsCount > this.connections.length
},
connectionsClass() { connectionsClass() {
const overflow = this.connections.length > 7 ? ' --overflow' : '' return `connections${this.hasMore ? '' : ' --overflow'}`
return `connections${overflow}`
}, },
filteredConnections() { filteredConnections() {
if (!this.filter) { if (!this.filter) {