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 (1231B)


  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. computed: {
  28. classes () {
  29. return {
  30. 'modal-background': !this.noBackground,
  31. open: this.isOpen
  32. }
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. .modal-view {
  39. z-index: var(--ZI_modals);
  40. position: fixed;
  41. top: 0;
  42. left: 0;
  43. right: 0;
  44. bottom: 0;
  45. display: flex;
  46. justify-content: center;
  47. align-items: center;
  48. overflow: auto;
  49. pointer-events: none;
  50. animation-duration: 0.2s;
  51. animation-name: modal-background-fadein;
  52. opacity: 0;
  53. > * {
  54. pointer-events: initial;
  55. }
  56. &.modal-background {
  57. pointer-events: initial;
  58. background-color: rgb(0 0 0 / 50%);
  59. }
  60. &.open {
  61. opacity: 1;
  62. }
  63. }
  64. @keyframes modal-background-fadein {
  65. from {
  66. background-color: rgb(0 0 0 / 0%);
  67. }
  68. to {
  69. background-color: rgb(0 0 0 / 50%);
  70. }
  71. }
  72. </style>