knowyt/_client/src/components/QuoteListItem.vue

83 lines
1.8 KiB
Vue

<template>
<div class="quote-list-item">
<div class="quote-list-item__separator" />
<div class="quote-list-item__container">
<div class="quote-list-item__quote">
{{ quote.quote }}
</div>
<div class="quote-list-item__actions">
<div class="quote-list-item__icon quote-list-item__icon-edit" @click="edit" />
<div class="quote-list-item__icon quote-list-item__icon-delete" @click="remove" />
</div>
</div>
</div>
</template>
<script>
export default {
props: ['quote'],
methods: {
async edit() {
this.$emit('editQuote', this.quote)
},
async remove() {
if (confirm('Eintrag wirklich löschen?')) {
this.$engine.removeQuote(this.quote.id)
await this.$engine.getMyQuotes()
}
},
},
}
</script>
<style lang="scss">
@import '~/assets/css/components';
.quote-list-item__container ~ .quote-list-item__container {
}
.quote-list-item {
& ~ & &__separator {
height: 1px;
margin: 0 40%;
background-color: $primary-text-color;
}
&__container {
display: flex;
justify-content: space-between;
padding: 48px 32px;
}
&__quote {
color: $primary-text-color;
}
&__actions {
display: flex;
margin: 0 32px;
}
&__icon {
width: 48px;
height: 48px;
margin-left: 16px;
background-color: $secondary-box-background-color;
border: 1px solid $secondary-box-border-color;
border-radius: 8px;
text-align: center;
line-height: 48px;
font-size: 32px;
color: $secondary-box-text-color;
cursor: pointer;
&:hover {
background-color: $secondary-box-hover-background-color;
border-color: $secondary-box-hover-border-color;
color: $secondary-box-hover-text-color;
}
&-edit::after {
content: '✎';
}
&-delete::after {
content: '🗑';
}
}
}
</style>