aboutsummaryrefslogtreecommitdiff
path: root/src/components/modal/modal.vue
blob: 2e3cbe75491ee5bfbce1ffb9b7c7c3ae09552177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
  <transition name="modal">
    <div class="modal-mask" @click="close" v-if="show">
      <div class="modal-container" @click.stop>
        <div class="modal-header">
          <h3 class="modal-title">{{title}}</h3>
        </div>
        <slot></slot>
        <a class="modal-close" @click="close"><i class="icon-cancel"></i></a>
      </div>
    </div>
  </transition>
</template>

<script src="./modal.js"></script>

<style lang="scss">
.modal-mask {
  position: fixed;
  z-index: 9998;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(27,31,35,.5);
  transition: opacity .3s ease;
}

.modal-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 450px;
  margin: 10vh auto;
  max-height: 80vh;
  max-width: 90vw;
  background-color: #fff;
  border: 1px solid #444d56;
  border-radius: 3px;
  box-shadow: 0 0 18px rgba(0,0,0,.4);
  transition: all .3s ease;
}

.modal-header {
  flex: none;
  background-color: #f6f8fa;
  border-bottom: 1px solid #d1d5da;
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
  padding: 16px;
  margin: 0;
}

h3.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 16px;
  cursor: pointer;
}

.modal-body {
  border-bottom: 1px solid #e1e4e8;
  padding: 16px;
  overflow-y: auto;
}

.modal-footer {
  flex: none;
  border-top: 1px solid #e1e4e8;
  margin-top: -1px;
  padding: 16px;
}

/*
 * The following styles are auto-applied to elements with
 * transition="modal" when their visibility is toggled
 * by Vue.js.
 */

.modal-enter {
  opacity: 0;
}

.modal-leave-active {
  opacity: 0;
}

.modal-enter .modal-container,
.modal-leave-active .modal-container {
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
}
</style>