GalleryView.vue 4.1 KB

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