GalleryView.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="gallery-view wh-100">
  3. <div class="gallery-view-wrapper wh-100">
  4. <figure class="gallery-view-figure">
  5. <div class="h-100" />
  6. <div class="node-view-img-wrapper">
  7. <img :src="node.image.url" :alt="node.image.alt">
  8. <button-expand
  9. v-if="node.iframeUrl || node.mediaItem" artwork
  10. v-b-modal="'modal-creation' + node.id" class="center"
  11. />
  12. <div class="btns-artwork">
  13. <b-button variant="depart" class="btn-shadow btn-artwork mr-2" @click="$emit('view-origin')">
  14. {{ $t('text.open-origin') }}
  15. </b-button>
  16. <b-button variant="creation" class="btn-shadow btn-artwork" v-b-toggle.gallery-text>
  17. {{ $t('text.open-artwork') }}
  18. </b-button>
  19. </div>
  20. </div>
  21. <figcaption class="gallery-view-caption">
  22. <node-view-title :node="node" tag="p" class="mb-0 mt-4" />
  23. </figcaption>
  24. </figure>
  25. <div
  26. v-for="(sibling, i) in node.creation_siblings" :key="sibling.id"
  27. class="gallery-view-btn-wrapper"
  28. :class="buttonClasses[i]"
  29. >
  30. <button-image :image="sibling.image" @click="$emit('open-creation', sibling.id)">
  31. <node-view-title
  32. :node="sibling"
  33. tag="span" link
  34. class="sr-only"
  35. />
  36. </button-image>
  37. </div>
  38. <side-view id="gallery-text" right no-cross>
  39. <template #default="{ hide }">
  40. <node-view
  41. :node="node"
  42. @close-node="hide"
  43. @open-node="$emit('view-origin')"
  44. force-type="ref" show-origin
  45. />
  46. </template>
  47. </side-view>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { NodeViewTitle, NodeView } from '@/components/nodes'
  53. import { SideView } from '@/components/layouts'
  54. import { trim, toCommaList, shuffle } from '@/helpers/common'
  55. export default {
  56. name: 'GalleryView',
  57. components: {
  58. NodeViewTitle,
  59. NodeView,
  60. SideView
  61. },
  62. props: {
  63. node: { type: Object, default: undefined }
  64. },
  65. data () {
  66. return {
  67. image: undefined,
  68. buttonClasses: [
  69. ['top', 'left'],
  70. ['top', 'right'],
  71. ['bottom', 'right'],
  72. ['bottom', 'left']
  73. ]
  74. }
  75. },
  76. methods: {
  77. trim,
  78. toCommaList
  79. },
  80. created () {
  81. this.buttonClasses = shuffle(this.buttonClasses)
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .gallery-view {
  87. margin: auto;
  88. &-wrapper {
  89. display: flex;
  90. }
  91. &-figure {
  92. display: flex;
  93. flex-direction: column;
  94. justify-content: space-between;
  95. align-items: center;
  96. height: calc(100% - 4rem);
  97. margin: auto;
  98. width: calc(100% - 4rem);
  99. @media (orientation: landscape) {
  100. width: calc(100% - 270px);
  101. @include media-breakpoint-up($size-bp) {
  102. width: calc(100% - 500px);
  103. }
  104. }
  105. .node-view-img-wrapper {
  106. flex-basis: 100%;
  107. flex-grow: 2;
  108. height: calc(100% - 270px - 4rem);
  109. @media (orientation: landscape) {
  110. height: calc(100% - 270px);
  111. @include media-breakpoint-up($size-bp) {
  112. height: calc(100% - 450px);
  113. }
  114. }
  115. }
  116. img {
  117. object-fit: cover;
  118. object-position: center;
  119. width: 100%;
  120. height: 100%;
  121. }
  122. .btns-artwork {
  123. position: absolute;
  124. @include media-breakpoint-down($size-bp-down) {
  125. top: -50px;
  126. width: 100%;
  127. display: flex;
  128. justify-content: space-between;
  129. }
  130. @include media-breakpoint-up($size-bp) {
  131. right: $node-view-spacer-sm-x;
  132. bottom: $node-view-spacer-sm-y;
  133. }
  134. }
  135. }
  136. &-caption {
  137. height: 100%;
  138. text-align: center;
  139. font-family: $font-family-text;
  140. @include media-breakpoint-up($size-bp) {
  141. font-size: 1.5rem;
  142. }
  143. }
  144. .gallery-view-btn-wrapper {
  145. position: absolute;
  146. overflow: hidden;
  147. &.left {
  148. left: 0;
  149. }
  150. &.right {
  151. right: 0;
  152. }
  153. &.top {
  154. top: 0;
  155. }
  156. &.bottom {
  157. bottom: 0;
  158. }
  159. }
  160. }
  161. ::v-deep #gallery-text {
  162. @include media-breakpoint-up($size-bp) {
  163. width: 100%;
  164. }
  165. .node-view {
  166. min-height: 100%;
  167. &-wrapper {
  168. min-height: 100%;
  169. }
  170. }
  171. }
  172. </style>