Improved content menu and empty profile page

This commit is contained in:
Grzegorz Leoniec 2019-01-18 12:14:57 +01:00
parent d29852b843
commit 272b1071d4
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
5 changed files with 64 additions and 27 deletions

View File

@ -8,13 +8,14 @@
slot="default"
slot-scope="{toggleMenu}"
>
<a
<ds-button
class="content-menu-trigger"
href="#"
@click.prevent="toggleMenu()"
size="small"
ghost
@click.prevent="toggleMenu"
>
<ds-icon name="ellipsis-v" />
</a>
</ds-button>
</template>
<div
slot="popover"

View File

@ -1,8 +1,8 @@
<template>
<ds-space
class="hc-empty"
margin="x-large"
centered
:margin="margin"
>
<ds-text>
<img
@ -13,6 +13,7 @@
alt="Empty"
><br>
<ds-text
v-show="message"
class="hc-empty-message"
color="softer"
>
@ -40,7 +41,17 @@ export default {
/**
* Message that appears under the icon
*/
message: { type: String, required: true }
message: {
type: String,
default: null
},
/**
* Vertical spacing
*/
margin: {
type: [String, Object],
default: 'x-large'
}
},
computed: {
iconPath() {

View File

@ -114,11 +114,13 @@ export default {
.ds-card-footer {
z-index: 1;
}
}
.content-menu {
display: inline-block;
margin-left: $space-small;
z-index: 1;
.content-menu {
display: inline-block;
margin-left: $space-xx-small;
margin-right: -$space-x-small;
z-index: 1;
}
}
.post-link {
display: block;

View File

@ -118,11 +118,10 @@
</div>
<ds-space margin-bottom="small" />
</div>
<div v-else>
<p style="text-align: center; opacity: .5;">
NO COMMENTS
</p>
</div>
<hc-empty
v-else
icon="messages"
/>
</ds-section>
</ds-card>
</template>
@ -132,6 +131,7 @@ import gql from 'graphql-tag'
import ContentMenu from '~/components/ContentMenu'
import HcAuthor from '~/components/Author.vue'
import HcShoutButton from '~/components/ShoutButton.vue'
import HcEmpty from '~/components/Empty.vue'
export default {
transition: {
@ -141,6 +141,7 @@ export default {
components: {
HcAuthor,
HcShoutButton,
HcEmpty,
ContentMenu
},
head() {

View File

@ -19,7 +19,6 @@
/>
<no-ssr>
<content-menu
style="float: right; display: inline-block; margin-top: -3.5rem; margin-right: -0.5rem;"
placement="bottom-end"
context="user"
:item-id="user.id"
@ -252,16 +251,26 @@
</ds-flex>
</ds-card>
</ds-flex-item>
<ds-flex-item
v-for="post in uniq(user.contributions.filter(post => !post.deleted))"
:key="post.id"
:width="{ base: '100%', md: '100%', xl: '50%' }"
>
<hc-post-card
:post="post"
:show-author-popover="false"
/>
</ds-flex-item>
<template v-if="activePosts">
<ds-flex-item
v-for="post in activePosts"
:key="post.id"
:width="{ base: '100%', md: '100%', xl: '50%' }"
>
<hc-post-card
:post="post"
:show-author-popover="false"
/>
</ds-flex-item>
</template>
<template v-else>
<ds-flex-item :width="{ base: '100%' }">
<hc-empty
margin="xx-large"
icon="file"
/>
</ds-flex-item>
</template>
</ds-flex>
<hc-load-more
v-if="hasMore"
@ -282,6 +291,7 @@ import HcFollowButton from '~/components/FollowButton.vue'
import HcCountTo from '~/components/CountTo.vue'
import HcBadges from '~/components/Badges.vue'
import HcLoadMore from '~/components/LoadMore.vue'
import HcEmpty from '~/components/Empty.vue'
import ContentMenu from '~/components/ContentMenu'
export default {
@ -292,6 +302,7 @@ export default {
HcCountTo,
HcBadges,
HcLoadMore,
HcEmpty,
ContentMenu
},
transition: {
@ -329,6 +340,9 @@ export default {
this.user.contributions &&
this.user.contributions.length < this.user.contributionsCount
)
},
activePosts() {
return this.uniq(this.user.contributions.filter(post => !post.deleted))
}
},
watch: {
@ -395,6 +409,14 @@ export default {
border: #fff 5px solid;
}
.page-name-profile-slug {
.ds-flex-item:first-child .content-menu {
position: absolute;
top: $space-x-small;
right: $space-x-small;
}
}
.profile-top-navigation {
position: sticky;
top: 53px;