Add component class to content component

This commit is contained in:
Ramon Wenger 2020-10-07 21:49:56 +02:00
parent 7fb61d9f05
commit 69e19591b3
1 changed files with 86 additions and 79 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<div <div
:class="{'content-component--bookmarked': bookmarked}" :class="componentClass"
:data-scrollto="component.id" :data-scrollto="component.id"
class="content-component"> >
<bookmark-actions <bookmark-actions
:bookmarked="bookmarked" :bookmarked="bookmarked"
:note="note" :note="note"
@ -80,6 +80,13 @@
}, },
showBookmarkActions() { showBookmarkActions() {
return this.component.type !== 'content_list' && this.component.type !== 'basic_knowledge' && !this.editModule; return this.component.type !== 'content_list' && this.component.type !== 'basic_knowledge' && !this.editModule;
},
componentClass() {
let classes = ['content-component', `content-component--${this.component.type}`];
if (this.bookmarked) {
classes.push('content-component--bookmarked');
}
return classes;
} }
}, },