api-client/components/ui/modal.vue

102 lines
2 KiB
Vue
Raw Normal View History

2019-09-06 10:41:18 +00:00
<template>
<transition name="modal" appear>
<div class="modal-backdrop">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-header">
<slot name="header"></slot>
</div>
<div class="modal-body">
<slot name="body"></slot>
2020-03-05 03:03:06 +00:00
<!-- <div class="fade top"></div>
<div class="fade bottom"></div> -->
</div>
<div class="modal-footer">
<slot name="footer"></slot>
2019-09-06 10:41:18 +00:00
</div>
</div>
</div>
</div>
</transition>
2019-09-06 10:41:18 +00:00
</template>
2019-12-06 01:41:38 +00:00
<style scoped lang="scss">
2019-11-02 05:32:21 +00:00
.modal-backdrop {
position: fixed;
z-index: 998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.32);
2019-11-02 05:32:21 +00:00
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
2019-09-06 10:41:18 +00:00
2019-11-02 05:32:21 +00:00
.modal-wrapper {
display: flex;
align-items: center;
justify-content: center;
flex-grow: 1;
}
2019-09-06 10:41:18 +00:00
2019-11-02 05:32:21 +00:00
.modal-container {
2020-03-05 01:18:10 +00:00
position: relative;
2019-11-02 05:32:21 +00:00
display: flex;
flex-grow: 1;
flex-direction: column;
margin: 16px;
padding: 16px;
2019-11-02 05:32:21 +00:00
transition: all 0.2s ease;
background-color: var(--bg-color);
2020-06-19 06:56:04 +00:00
border-radius: 8px;
box-shadow: 0px 16px 70px rgba(0, 0, 0, 0.5);
2020-03-03 01:32:27 +00:00
max-height: calc(100vh - 128px);
max-width: 720px;
}
.modal-body {
overflow: auto;
2019-11-02 05:32:21 +00:00
}
2019-09-06 10:41:18 +00:00
2019-11-02 05:32:21 +00:00
/*
2019-10-25 08:14:34 +00:00
* The following styles are auto-applied to elements with
* transition="modal" when their visibility is toggled
* by Vue.js.
*
* You can easily play with the modal transition by editing
* these styles.
*/
2019-09-06 10:41:18 +00:00
.modal-enter,
.modal-leave-active {
2019-11-02 05:32:21 +00:00
opacity: 0;
}
2019-09-06 10:41:18 +00:00
.modal-enter .modal-container,
.modal-leave-active .modal-container {
2019-11-02 05:32:21 +00:00
transform: scale(0.8);
transition: all 0.2s ease-in-out;
}
2020-03-05 01:18:10 +00:00
.fade {
position: absolute;
left: 16px;
right: 20px;
display: block;
height: 32px;
transition: all 0.2s;
&.top {
top: 68px;
background: linear-gradient(to bottom, var(--bg-color), transparent);
}
&.bottom {
bottom: 16px;
background: linear-gradient(to top, var(--bg-color), transparent);
}
}
2019-09-09 05:57:00 +00:00
</style>