GalleryView.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. force-type="ref" show-origin
  41. />
  42. </template>
  43. </side-view>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import { NodeViewTitle, NodeView } from '@/components/nodes'
  49. import { SideView } from '@/components/layouts'
  50. import { trim, toCommaList, shuffle } from '@/helpers/common'
  51. export default {
  52. name: 'GalleryView',
  53. components: {
  54. NodeViewTitle,
  55. NodeView,
  56. SideView
  57. },
  58. props: {
  59. node: { type: Object, default: undefined }
  60. },
  61. data () {
  62. return {
  63. image: undefined,
  64. buttonClasses: [
  65. ['top', 'left'],
  66. ['top', 'right'],
  67. ['bottom', 'right'],
  68. ['bottom', 'left']
  69. ]
  70. }
  71. },
  72. methods: {
  73. trim,
  74. toCommaList
  75. },
  76. created () {
  77. this.buttonClasses = shuffle(this.buttonClasses)
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .gallery-view {
  83. margin: auto;
  84. &-wrapper {
  85. display: flex;
  86. }
  87. &-figure {
  88. display: flex;
  89. flex-direction: column;
  90. justify-content: space-between;
  91. align-items: center;
  92. height: calc(100% - 4rem);
  93. margin: auto;
  94. width: calc(100% - 4rem);
  95. @media (orientation: landscape) {
  96. width: calc(100% - 270px);
  97. @include media-breakpoint-up($size-bp) {
  98. width: calc(100% - 500px);
  99. }
  100. }
  101. .node-view-img-wrapper {
  102. flex-basis: 100%;
  103. flex-grow: 2;
  104. height: calc(100% - 270px - 4rem);
  105. @media (orientation: landscape) {
  106. height: calc(100% - 270px);
  107. @include media-breakpoint-up($size-bp) {
  108. height: calc(100% - 450px);
  109. }
  110. }
  111. }
  112. img {
  113. object-fit: cover;
  114. object-position: center;
  115. width: 100%;
  116. height: 100%;
  117. }
  118. .btns-artwork {
  119. position: absolute;
  120. @include media-breakpoint-down($size-bp-down) {
  121. top: -50px;
  122. width: 100%;
  123. display: flex;
  124. justify-content: space-between;
  125. }
  126. @include media-breakpoint-up($size-bp) {
  127. right: $node-view-spacer-sm-x;
  128. bottom: $node-view-spacer-sm-y;
  129. }
  130. }
  131. }
  132. &-caption {
  133. height: 100%;
  134. text-align: center;
  135. font-family: $font-family-text;
  136. @include media-breakpoint-up($size-bp) {
  137. font-size: 1.5rem;
  138. }
  139. }
  140. .gallery-view-btn-wrapper {
  141. position: absolute;
  142. overflow: hidden;
  143. &.left {
  144. left: 0;
  145. }
  146. &.right {
  147. right: 0;
  148. }
  149. &.top {
  150. top: 0;
  151. }
  152. &.bottom {
  153. bottom: 0;
  154. }
  155. }
  156. }
  157. ::v-deep #gallery-text {
  158. @include media-breakpoint-up($size-bp) {
  159. width: 100%;
  160. }
  161. .node-view {
  162. min-height: 100%;
  163. &-wrapper {
  164. min-height: 100%;
  165. }
  166. }
  167. }
  168. </style>