add NodeViewTitle component

This commit is contained in:
axolotle
2021-06-22 22:29:37 +02:00
parent 3450d1b546
commit 1a1c4875a1
2 changed files with 74 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
<template>
<component
:is="tag"
class="node-view-title"
:class="{ block }"
>
<component
:is="link ? 'a' : 'div'"
@click="onTitleClick(node)"
class="node-view-title-container"
>
<slot name="default" />
<strong>{{ toCommaList(node.authors) }}</strong>,
<span>
<span v-if="node.preTitle" v-html="trim(node.preTitle) + ', '" />
<em v-html="trim(node.title) || 'pas de titre ital'" />
</span>
<div v-if="edition && node.edition" class="edition">
{{ node.edition.map(ed => ed.name).join(' ') }}
</div>
</component>
</component>
</template>
<script>
import { trim, toCommaList } from '@/helpers/common'
export default {
name: 'NodeViewTitle',
props: {
node: { type: Object, required: true },
tag: { type: String, default: 'h6' },
link: { type: Boolean, default: false },
block: { type: Boolean, default: false },
edition: { type: Boolean, default: false }
},
data () {
return {
}
},
methods: {
trim,
toCommaList,
onTitleClick (node) {
if (this.link) {
this.$emit('open-node')
}
}
}
}
</script>
<style lang="scss" scoped>
.node-view-title {
font-weight: $font-weight-normal;
a {
text-decoration: none;
cursor: pointer;
}
&.block &-container {
> * {
display: block;
}
}
}
</style>
+1
View File
@@ -1,4 +1,5 @@
export { default as NodeViewChildList } from './NodeViewChildList'
export { default as NodeViewTitle } from './NodeViewTitle'
export { default as NodeViewHeaderRef } from './NodeViewHeaderRef'
export { default as NodeViewHeaderProd } from './NodeViewHeaderProd'
export { default as NodeViewBody } from './NodeViewBody'