ModalWindow.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class='modal_window__overlay' :class='{"modal_window--show": value}' @click.self='closeModal'>
  3. <div class='modal_window' :class='{"modal_window--show": value}' :style='{"width": width || "20rem"}'>
  4. <slot></slot>
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'ModalWindow',
  11. props: ['value', 'width'],
  12. methods: {
  13. closeModal () {
  14. this.$emit('input', false)
  15. }
  16. }
  17. }
  18. </script>
  19. <style lang='scss' scoped>
  20. @import '../assets/scss/variables.scss';
  21. .modal_window__overlay {
  22. width: 100%;
  23. height: 100%;
  24. background-color: rgba(0, 0, 0, 0.5);
  25. display: flex;
  26. align-items: center;
  27. justify-content: center;
  28. position: fixed;
  29. z-index: 3;
  30. top: 0;
  31. left: 0;
  32. opacity: 0;
  33. pointer-events: none;
  34. transition: opacity 0.3s;
  35. @at-root #{&}--show {
  36. opacity: 1;
  37. pointer-events: all;
  38. transition: opacity 0.3s;
  39. }
  40. }
  41. .modal_window {
  42. box-shadow: 0 14px 28px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.10);
  43. background-color: #fff;
  44. //margin-top: -3rem;
  45. opacity: 0;
  46. position: relative;
  47. border: 0.125rem solid $color__gray--darkest;
  48. border-radius: 0.25rem;
  49. pointer-events: none;
  50. transform: scale(1.1);
  51. transition: margin-top 0.3s, opacity 0.3s, transform 0.3s;
  52. @at-root #{&}--show {
  53. margin-top: 0;
  54. transform: scale(1);
  55. opacity: 1;
  56. pointer-events: all;
  57. transition: all 0.3s;
  58. }
  59. }
  60. </style>