bookmarks/src/components/TagLine.vue

74 lines
1.3 KiB
Vue
Raw Normal View History

2020-09-21 12:25:50 +00:00
<!--
- Copyright (c) 2020. The Nextcloud Bookmarks contributors.
-
- This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
-->
2019-08-04 21:49:07 +00:00
<template>
<div class="tagline">
2020-08-13 09:41:32 +00:00
<div v-for="tag in tags"
:key="tag"
class="tagline__tag"
role="button"
@click="clickTag($event, tag)">
{{ tag }}
</div>
</div>
2019-08-04 21:49:07 +00:00
</template>
<script>
import { privateRoutes, publicRoutes } from '../router.js'
2020-08-13 09:41:32 +00:00
2019-08-04 21:49:07 +00:00
export default {
name: 'TagLine',
components: {},
props: {
tags: {
type: Array,
required: true,
},
2019-08-04 21:49:07 +00:00
},
data() {
return {}
2019-08-04 21:49:07 +00:00
},
2020-08-13 09:41:32 +00:00
computed: {
routes() {
return this.$store.state.public ? publicRoutes : privateRoutes
},
},
2019-08-04 21:49:07 +00:00
created() {},
methods: {
clickTag(e, tag) {
e.preventDefault()
e.stopImmediatePropagation()
e.stopPropagation()
2020-08-13 09:41:32 +00:00
this.$router.push({ name: this.routes.TAGS, params: { tags: tag } })
},
},
}
2019-08-04 21:49:07 +00:00
</script>
<style>
2019-08-26 12:57:02 +00:00
.tagline {
2019-08-04 21:49:07 +00:00
font-size: 12px;
height: 24px;
line-height: 1;
overflow: hidden;
display: inline-block;
margin: 0 15px;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.tagline__tag {
2019-08-04 21:49:07 +00:00
display: inline-block;
border: 1px solid var(--color-border);
border-radius: var(--border-radius-pill);
padding: 5px 10px;
2019-08-26 18:25:39 +00:00
margin-right: 3px;
2019-08-13 19:35:32 +00:00
background-color: var(--color-main-background);
2020-08-13 09:41:32 +00:00
cursor: pointer;
2019-08-04 21:49:07 +00:00
}
2019-08-26 22:41:52 +00:00
2020-08-21 15:53:44 +00:00
.tagline__tag:hover,
.tagline__tag:focus {
2019-08-04 21:49:07 +00:00
background-color: var(--color-background-dark);
}
</style>