Add component class to content component
This commit is contained in:
parent
7fb61d9f05
commit
69e19591b3
|
|
@ -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"
|
||||||
|
|
@ -19,31 +19,31 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
import TextBlock from '@/components/content-blocks/TextBlock';
|
import TextBlock from '@/components/content-blocks/TextBlock';
|
||||||
import InstrumentWidget from '@/components/content-blocks/InstrumentWidget';
|
import InstrumentWidget from '@/components/content-blocks/InstrumentWidget';
|
||||||
import ImageBlock from '@/components/content-blocks/ImageBlock';
|
import ImageBlock from '@/components/content-blocks/ImageBlock';
|
||||||
import ImageUrlBlock from '@/components/content-blocks/ImageUrlBlock';
|
import ImageUrlBlock from '@/components/content-blocks/ImageUrlBlock';
|
||||||
import VideoBlock from '@/components/content-blocks/VideoBlock';
|
import VideoBlock from '@/components/content-blocks/VideoBlock';
|
||||||
import LinkBlock from '@/components/content-blocks/LinkBlock';
|
import LinkBlock from '@/components/content-blocks/LinkBlock';
|
||||||
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
|
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
|
||||||
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
|
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
|
||||||
import ThinglinkBlock from '@/components/content-blocks/ThinglinkBlock';
|
import ThinglinkBlock from '@/components/content-blocks/ThinglinkBlock';
|
||||||
import GeniallyBlock from '@/components/content-blocks/GeniallyBlock';
|
import GeniallyBlock from '@/components/content-blocks/GeniallyBlock';
|
||||||
import SubtitleBlock from '@/components/content-blocks/SubtitleBlock';
|
import SubtitleBlock from '@/components/content-blocks/SubtitleBlock';
|
||||||
import SectionTitleBlock from '@/components/content-blocks/SectionTitleBlock';
|
import SectionTitleBlock from '@/components/content-blocks/SectionTitleBlock';
|
||||||
import ContentListBlock from '@/components/content-blocks/ContentListBlock';
|
import ContentListBlock from '@/components/content-blocks/ContentListBlock';
|
||||||
import ModuleRoomSlug from '@/components/content-blocks/ModuleRoomSlug';
|
import ModuleRoomSlug from '@/components/content-blocks/ModuleRoomSlug';
|
||||||
import Assignment from '@/components/content-blocks/assignment/Assignment';
|
import Assignment from '@/components/content-blocks/assignment/Assignment';
|
||||||
import Survey from '@/components/content-blocks/SurveyBlock';
|
import Survey from '@/components/content-blocks/SurveyBlock';
|
||||||
import Solution from '@/components/content-blocks/Solution';
|
import Solution from '@/components/content-blocks/Solution';
|
||||||
import Instruction from '@/components/content-blocks/Instruction';
|
import Instruction from '@/components/content-blocks/Instruction';
|
||||||
import BookmarkActions from '@/components/notes/BookmarkActions';
|
import BookmarkActions from '@/components/notes/BookmarkActions';
|
||||||
|
|
||||||
import {constructContentComponentBookmarkMutation} from '@/helpers/update-content-bookmark-mutation';
|
import {constructContentComponentBookmarkMutation} from '@/helpers/update-content-bookmark-mutation';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['component', 'parent', 'bookmarks', 'notes', 'root'],
|
props: ['component', 'parent', 'bookmarks', 'notes', 'root'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -98,17 +105,17 @@
|
||||||
this.$apollo.mutate(constructContentComponentBookmarkMutation(uuid, bookmarked, this.parent, this.root));
|
this.$apollo.mutate(constructContentComponentBookmarkMutation(uuid, bookmarked, this.parent, this.root));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "@/styles/_variables.scss";
|
@import "@/styles/_variables.scss";
|
||||||
|
|
||||||
.content-component {
|
.content-component {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&--bookmarked {
|
&--bookmarked {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue