add NodeViewTitle component
This commit is contained in:
@@ -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,4 +1,5 @@
|
|||||||
export { default as NodeViewChildList } from './NodeViewChildList'
|
export { default as NodeViewChildList } from './NodeViewChildList'
|
||||||
|
export { default as NodeViewTitle } from './NodeViewTitle'
|
||||||
export { default as NodeViewHeaderRef } from './NodeViewHeaderRef'
|
export { default as NodeViewHeaderRef } from './NodeViewHeaderRef'
|
||||||
export { default as NodeViewHeaderProd } from './NodeViewHeaderProd'
|
export { default as NodeViewHeaderProd } from './NodeViewHeaderProd'
|
||||||
export { default as NodeViewBody } from './NodeViewBody'
|
export { default as NodeViewBody } from './NodeViewBody'
|
||||||
|
|||||||
Reference in New Issue
Block a user