fixed post card links

This commit is contained in:
Grzegorz Leoniec 2018-12-29 18:36:17 +01:00
parent 5f8d94e13e
commit a9db76e24b
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
3 changed files with 122 additions and 97 deletions

View File

@ -126,3 +126,15 @@ hr {
background-color: $color-neutral-80; background-color: $color-neutral-80;
height: 1px !important; height: 1px !important;
} }
[class$=menu-trigger] {
user-select: none;
}
[class$=menu-popover] {
display: inline-block;
nav {
margin-left: -17px;
margin-right: -15px;
}
}

View File

@ -1,13 +1,16 @@
<template> <template>
<a
v-router-link
:href="href(post)"
>
<ds-card <ds-card
:header="post.title" :header="post.title"
:image="post.image" :image="post.image"
style="cursor: pointer; position: relative;" class="post-card"
> >
<a
v-router-link
class="post-link"
:href="href(post)"
>
{{ post.title }}
</a>
<no-ssr> <no-ssr>
<dropdown class="post-menu"> <dropdown class="post-menu">
<template <template
@ -19,7 +22,7 @@
href="#" href="#"
@click.prevent="toggleMenu()" @click.prevent="toggleMenu()"
> >
Options <ds-icon name="angle-down" />
</a> </a>
</template> </template>
<template <template
@ -27,10 +30,7 @@
slot-scope="{toggleMenu}" slot-scope="{toggleMenu}"
> >
<div class="post-menu-popover"> <div class="post-menu-popover">
<ds-menu <ds-menu :routes="routes">
:routes="routes"
:is-exact="isExact"
>
<ds-menu-item <ds-menu-item
slot="Navigation" slot="Navigation"
slot-scope="item" slot-scope="item"
@ -41,10 +41,6 @@
<ds-icon :name="item.route.icon" /> {{ item.route.name }} <ds-icon :name="item.route.icon" /> {{ item.route.name }}
</ds-menu-item> </ds-menu-item>
</ds-menu> </ds-menu>
<ds-space margin="xx-small" />
<nuxt-link :to="{ name: 'logout'}">
<ds-icon name="sign-out" /> {{ $t('login.logout') }}
</nuxt-link>
</div> </div>
</template> </template>
</dropdown> </dropdown>
@ -60,7 +56,7 @@
<!-- eslint-enable vue/no-v-html --> <!-- eslint-enable vue/no-v-html -->
<ds-space <ds-space
margin="small" margin="small"
style="position: absolute; bottom: 44px;" style="position: absolute; bottom: 44px; z-index: 1;"
> >
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
@ -91,7 +87,6 @@
</div> </div>
</template> </template>
</ds-card> </ds-card>
</a>
</template> </template>
<script> <script>
@ -155,10 +150,34 @@ export default {
name: 'post-slug', name: 'post-slug',
params: { slug: post.slug } params: { slug: post.slug }
}).href }).href
},
isExact(url) {
return this.$route.path.indexOf(url) === 0
} }
} }
} }
</script> </script>
<style lang="scss">
.post-card {
cursor: pointer;
position: relative;
.ds-card-footer {
z-index: 1;
}
}
.post-menu {
position: absolute;
top: $space-small;
right: $space-small;
z-index: 1;
}
.post-link {
display: block;
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-indent: -999999px;
}
</style>

View File

@ -138,17 +138,11 @@ export default {
float: right; float: right;
} }
.avatar-menu-trigger {
user-select: none;
}
.avatar-menu-popover { .avatar-menu-popover {
display: inline-block;
padding-top: 0.5rem; padding-top: 0.5rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
nav { nav {
margin-left: -15px;
margin-right: -15px;
padding-top: 1rem; padding-top: 1rem;
padding-bottom: 1rem; padding-bottom: 1rem;
} }