Skip to content

Commit 06baed1

Browse files
committed
Place BlockButton into slot in FollowButtons
1 parent d84e9d9 commit 06baed1

File tree

4 files changed

+17
-33
lines changed

4 files changed

+17
-33
lines changed

components/Global/Elements/BlockButton/BlockButton.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('BlockButton.vue', () => {
3636

3737
test('renders', () => {
3838
wrapper = shallowMount(BlockButton, { store, localVue, propsData, mocks })
39-
expect(wrapper.is('div')).toBeTruthy()
39+
expect(wrapper.is('hc-button-stub')).toBeTruthy()
4040
})
4141

4242
describe('request pending', () => {

components/Global/Elements/BlockButton/BlockButton.vue

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
<template>
2-
<div class="columns is-mobile field has-text-centered">
3-
<div class="column control has-text-centered">
4-
<hc-button color="button"
5-
:disabled="isPending"
6-
:isLoading="isPending"
7-
@click="click">
8-
<template v-if="isBlacklisted()">
9-
<hc-icon icon="ban" :class="['icon-left', 'is-danger']" /> {{ $t('component.blacklist.buttonLabelUnblock') }}
10-
</template>
11-
<template v-else>
12-
<hc-icon icon="ban" class="icon-left" /> {{ $t('component.blacklist.buttonLabelBlock') }}
13-
</template>
14-
</hc-button>
15-
</div>
16-
</div>
2+
<hc-button color="button"
3+
:disabled="isPending"
4+
:isLoading="isPending"
5+
@click="click">
6+
<template v-if="isBlacklisted()">
7+
<hc-icon icon="ban" :class="['icon-left', 'is-danger']" /> {{ $t('component.blacklist.buttonLabelUnblock') }}
8+
</template>
9+
<template v-else>
10+
<hc-icon icon="ban" class="icon-left" /> {{ $t('component.blacklist.buttonLabelBlock') }}
11+
</template>
12+
</hc-button>
1713
</template>
1814
<script>
1915
import Icon from '~/components/Global/Elements/Icon/Icon.vue'

components/Global/Elements/Follow/FollowButtons.vue

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@
2929
</template>
3030
</hc-button>
3131
</div>
32-
<div v-if="service === 'users'" class="column control has-text-centered" style="opacity: .25; pointer-events: none;">
33-
<hc-button color="button" @click="toggleConnected" :disabled="true">
34-
<template v-if="connected">
35-
<hc-icon icon="user-times" class="icon-left" /> Trennen
36-
</template>
37-
<template v-else>
38-
<hc-icon icon="user" class="icon-left" /> Verbinden
39-
</template>
40-
</hc-button>
32+
<div v-if="service === 'users'" class="column is-mobile field has-text-centered">
33+
<slot></slot>
4134
</div>
4235
</div>
4336
</div>
@@ -106,12 +99,6 @@
10699
})
107100
})
108101
}
109-
},
110-
toggleConnected () {
111-
this.connected = !this.connected
112-
this.$snackbar.open({
113-
message: 'Connected!'
114-
})
115102
}
116103
}
117104
}

pages/profile/_slug.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
</template>
4141
<hc-follow-buttons v-if="user"
4242
:showButtons="!isOwner"
43-
:entity="user" />
43+
:entity="user">
44+
<hc-block-button v-if="user && !isOwner" :foreignEntity="user" :confirmation="confirmUnfollow"/>
45+
</hc-follow-buttons>
4446

45-
<hc-block-button v-if="user && !isOwner" :foreignEntity="user" :confirmation="confirmUnfollow"/>
4647
<div v-if="false" class="hc-shortcuts level under-construction">
4748
<!-- TODO: replace the cdn images with local hc icons -->
4849
<div class="level-item has-text-centered">

0 commit comments

Comments
 (0)