NodeViewFigure.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <figure class="node-view-figure mt-2 mb-4">
  3. <div class="node-view-img-wrapper">
  4. <img :src="node.image.url" :alt="node.image.alt">
  5. <button-expand @click="onImageExpand" v-b-modal="'modal-image-' + node.id" />
  6. <b-button variant="creation" class="btn-shadow btn-artwork" @click="onCreationClick">
  7. {{ $t('text.read-artwork') }}
  8. </b-button>
  9. </div>
  10. <figcaption class="mt-3">
  11. <node-view-title :node="node" tag="p" class="m-0" />
  12. </figcaption>
  13. </figure>
  14. </template>
  15. <script>
  16. import { trim, toCommaList } from '@/helpers/common'
  17. import { NodeViewTitle } from '@/components/nodes'
  18. export default {
  19. name: 'NodeViewFigure',
  20. components: {
  21. NodeViewTitle
  22. },
  23. props: {
  24. node: { type: Object, required: true }
  25. },
  26. methods: {
  27. trim,
  28. toCommaList,
  29. onImageExpand () {
  30. this.$emit('expand-image', this.node.image)
  31. },
  32. onCreationClick () {
  33. this.$store.dispatch('OPEN_CREATION', { id: this.node.id, map: false })
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .node-view-figure {
  40. .btn-artwork {
  41. position: absolute;
  42. right: $node-view-spacer-sm-x;
  43. bottom: $node-view-spacer-sm-y;
  44. }
  45. img {
  46. max-width: 100%;
  47. }
  48. }
  49. </style>