FullscreenModal.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <b-modal
  3. :id="id"
  4. modal-class="modal-image"
  5. hide-footer hide-header
  6. >
  7. <template #default="{ close }">
  8. <div class="modal-image-wrapper">
  9. <button-expand expanded @click="close()" />
  10. <img
  11. v-if="image"
  12. :src="image.url" :alt="image.alt"
  13. @click="close()"
  14. >
  15. </div>
  16. </template>
  17. </b-modal>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'FullscreenModal',
  22. props: {
  23. image: { type: Object, default: null },
  24. id: { type: String, required: true }
  25. }
  26. }
  27. </script>
  28. <style lang="scss">
  29. .modal-image {
  30. z-index: 1100;
  31. .modal {
  32. &-dialog {
  33. max-width: 100%;
  34. height: 100%;
  35. margin: 0;
  36. }
  37. &-content {
  38. height: 100%;
  39. border: 0;
  40. background-color: transparent;
  41. pointer-events: none;
  42. }
  43. &-body {
  44. position: relative;
  45. padding: 0;
  46. display: flex;
  47. align-items: center;
  48. justify-content: center;
  49. .modal-image-wrapper {
  50. pointer-events: auto;
  51. position: relative;
  52. &:not(:hover) .btn-expand {
  53. display: none;
  54. }
  55. }
  56. .btn-expand {
  57. position: absolute;
  58. top: 0;
  59. right: 0;
  60. z-index: 1;
  61. }
  62. img {
  63. max-width: 100vw;
  64. max-height: 100vh;
  65. display: block;
  66. }
  67. }
  68. }
  69. }
  70. </style>