mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor: ds-space out, general markup clean
This commit is contained in:
parent
4c344ee4ad
commit
a6484e3d0c
@ -67,14 +67,14 @@ describe('FollowList.vue', () => {
|
|||||||
describe('without connections', () => {
|
describe('without connections', () => {
|
||||||
it('displays the followingNobody message', () => {
|
it('displays the followingNobody message', () => {
|
||||||
const wrapper = Wrapper({ user: noConnectionsUser })
|
const wrapper = Wrapper({ user: noConnectionsUser })
|
||||||
expect(wrapper.find('.no-connections').text()).toBe(
|
expect(wrapper.find('.nobody-message').text()).toBe(
|
||||||
`${noConnectionsUser.name} ${wrapper.vm.$t(`profile.network.followingNobody`)}`,
|
`${noConnectionsUser.name} ${wrapper.vm.$t(`profile.network.followingNobody`)}`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays the followedByNobody message', () => {
|
it('displays the followedByNobody message', () => {
|
||||||
const wrapper = Wrapper({ user: noConnectionsUser, type: 'followedBy' })
|
const wrapper = Wrapper({ user: noConnectionsUser, type: 'followedBy' })
|
||||||
expect(wrapper.find('.no-connections').text()).toBe(
|
expect(wrapper.find('.nobody-message').text()).toBe(
|
||||||
`${noConnectionsUser.name} ${wrapper.vm.$t(`profile.network.followedByNobody`)}`,
|
`${noConnectionsUser.name} ${wrapper.vm.$t(`profile.network.followedByNobody`)}`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -118,9 +118,9 @@ describe('FollowList.vue', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the user-teaser in an overflow-container', () => {
|
it('renders the user-teasers in an overflow-container', () => {
|
||||||
expect(followingWrapper.find('.overflow-container').is('div')).toBe(true)
|
expect(followingWrapper.find('.--overflow').is('div')).toBe(true)
|
||||||
expect(followedByWrapper.find('.overflow-container').is('div')).toBe(true)
|
expect(followedByWrapper.find('.--overflow').is('div')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders a filter text input', () => {
|
it('renders a filter text input', () => {
|
||||||
|
|||||||
@ -1,23 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<base-card class="follow-list">
|
<base-card class="follow-list">
|
||||||
<ds-space v-if="connections && connections.length" margin="x-small">
|
<template v-if="connections && connections.length">
|
||||||
<ds-text tag="h5" color="soft">
|
<ds-text tag="h5" color="soft" class="spacer-x-small">
|
||||||
{{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }}
|
{{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }}
|
||||||
</ds-text>
|
</ds-text>
|
||||||
</ds-space>
|
<div :class="connectionsClass">
|
||||||
<template v-else>
|
<user-teaser
|
||||||
<p class="no-connections">{{ userName }} {{ $t(`profile.network.${type}Nobody`) }}</p>
|
v-for="connection in filteredConnections"
|
||||||
</template>
|
class="spacer-x-small"
|
||||||
<template v-if="connections && connections.length <= 7">
|
:user="connection"
|
||||||
<ds-space v-for="connection in connections" :key="connection.id" margin="x-small">
|
:key="connection.id"
|
||||||
<user-teaser :user="connection" />
|
/>
|
||||||
</ds-space>
|
</div>
|
||||||
<ds-space v-if="allConnectionsCount - connections.length" margin="small">
|
|
||||||
<base-button
|
<base-button
|
||||||
|
v-if="allConnectionsCount - connections.length"
|
||||||
@click="$emit('fetchAllConnections', type)"
|
@click="$emit('fetchAllConnections', type)"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
size="small"
|
size="small"
|
||||||
color="softer"
|
color="softer"
|
||||||
|
class="spacer-x-small"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
$t('profile.network.andMore', {
|
$t('profile.network.andMore', {
|
||||||
@ -25,25 +26,18 @@
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</base-button>
|
</base-button>
|
||||||
</ds-space>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="connections.length > 7">
|
|
||||||
<div class="overflow-container">
|
|
||||||
<ds-space v-for="connection in filteredConnections" :key="connection.id" margin="x-small">
|
|
||||||
<user-teaser :user="connection" />
|
|
||||||
</ds-space>
|
|
||||||
</div>
|
|
||||||
<ds-space margin="x-small">
|
|
||||||
<ds-input
|
<ds-input
|
||||||
|
v-if="connections.length > 7"
|
||||||
@input.native="setFilter"
|
@input.native="setFilter"
|
||||||
:placeholder="filter"
|
:placeholder="filter"
|
||||||
v-focus="true"
|
v-focus="true"
|
||||||
size="small"
|
size="small"
|
||||||
icon="filter"
|
icon="filter"
|
||||||
:name="`${type}Filter`"
|
:name="`${type}Filter`"
|
||||||
|
class="spacer-x-small"
|
||||||
/>
|
/>
|
||||||
</ds-space>
|
|
||||||
</template>
|
</template>
|
||||||
|
<p v-else class="nobody-message">{{ userName }} {{ $t(`profile.network.${type}Nobody`) }}</p>
|
||||||
</base-card>
|
</base-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -76,6 +70,10 @@ export default {
|
|||||||
connections() {
|
connections() {
|
||||||
return this.user[this.type]
|
return this.user[this.type]
|
||||||
},
|
},
|
||||||
|
connectionsClass() {
|
||||||
|
const overflow = this.connections.length > 7 ? ' --overflow' : ''
|
||||||
|
return `connections${overflow}`
|
||||||
|
},
|
||||||
filteredConnections() {
|
filteredConnections() {
|
||||||
if (!this.filter) {
|
if (!this.filter) {
|
||||||
return this.connections
|
return this.connections
|
||||||
@ -111,19 +109,25 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.follow-list {
|
.follow-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-height: ($size-avatar-small + $space-x-small * 2) * 8;
|
//max-height: ($size-avatar-small + $space-x-small * 2) * 8;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
> .no-connections {
|
.connections.--overflow {
|
||||||
text-align: center;
|
|
||||||
color: $text-color-soft;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .overflow-container {
|
|
||||||
height: ($size-avatar-base + $space-x-small * 2) * 5;
|
height: ($size-avatar-base + $space-x-small * 2) * 5;
|
||||||
margin-top: -$space-x-small;
|
margin-top: -$space-x-small;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nobody-message {
|
||||||
|
text-align: center;
|
||||||
|
color: $text-color-soft;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spacer-x-small {
|
||||||
|
margin: $space-x-small 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user