logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

modal.vue (1261B)


  1. <template>
  2. <div
  3. v-show="isOpen"
  4. v-body-scroll-lock="isOpen && !noBackground"
  5. class="modal-view"
  6. :class="classes"
  7. @click.self="$emit('backdropClicked')"
  8. >
  9. <slot />
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. provide: {
  15. popoversZLayer: 'modals'
  16. },
  17. props: {
  18. isOpen: {
  19. type: Boolean,
  20. default: true
  21. },
  22. noBackground: {
  23. type: Boolean,
  24. default: false
  25. }
  26. },
  27. emits: ['backdropClicked'],
  28. computed: {
  29. classes () {
  30. return {
  31. 'modal-background': !this.noBackground,
  32. open: this.isOpen
  33. }
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. .modal-view {
  40. z-index: var(--ZI_modals);
  41. position: fixed;
  42. top: 0;
  43. left: 0;
  44. right: 0;
  45. bottom: 0;
  46. display: flex;
  47. justify-content: center;
  48. align-items: center;
  49. overflow: auto;
  50. pointer-events: none;
  51. animation-duration: 0.2s;
  52. animation-name: modal-background-fadein;
  53. opacity: 0;
  54. > * {
  55. pointer-events: initial;
  56. }
  57. &.modal-background {
  58. pointer-events: initial;
  59. background-color: rgb(0 0 0 / 50%);
  60. }
  61. &.open {
  62. opacity: 1;
  63. }
  64. }
  65. @keyframes modal-background-fadein {
  66. from {
  67. background-color: rgb(0 0 0 / 0%);
  68. }
  69. to {
  70. background-color: rgb(0 0 0 / 50%);
  71. }
  72. }
  73. </style>