2018-02-05 03:15:35 +00:00
|
|
|
<div class="modal-dialog-backdrop" tabindex="-1" data-a11y-dialog-hide></div>
|
|
|
|
<div class="modal-dialog-contents" role="dialog" aria-label="{{label}}" ref:node>
|
|
|
|
<div class="modal-dialog-document" role="document" style="background: {{background || '#000'}};">
|
|
|
|
<div class="close-dialog-button-wrapper">
|
|
|
|
<button class="close-dialog-button" data-a11y-dialog-hide aria-label="Close dialog">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<slot></slot>
|
2018-02-04 21:49:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<style>
|
2018-02-05 03:15:35 +00:00
|
|
|
:global(#modal-dialog[aria-hidden='true']) {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.modal-dialog-backdrop {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 10000;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
top: 0;
|
|
|
|
background: rgba(51, 51, 51, 0.9);
|
|
|
|
}
|
|
|
|
.modal-dialog-contents {
|
|
|
|
z-index: 10010;
|
2018-02-04 21:49:43 +00:00
|
|
|
position: fixed;
|
|
|
|
top: 50%;
|
2018-02-05 03:15:35 +00:00
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%, -50%);
|
2018-02-04 21:49:43 +00:00
|
|
|
padding: 0;
|
|
|
|
border: 3px solid var(--main-border);
|
|
|
|
}
|
2018-02-05 03:15:35 +00:00
|
|
|
.modal-dialog-document {
|
2018-02-04 21:49:43 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
.close-dialog-button-wrapper {
|
|
|
|
text-align: right;
|
|
|
|
width: 100%;
|
|
|
|
background: var(--nav-bg)
|
|
|
|
}
|
|
|
|
.close-dialog-button {
|
2018-02-04 23:59:42 +00:00
|
|
|
padding: 0 0 7px;
|
2018-02-04 21:49:43 +00:00
|
|
|
background: none;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
.close-dialog-button span {
|
|
|
|
padding: 0 15px;
|
|
|
|
font-size: 48px;
|
|
|
|
color: var(--button-primary-text);
|
|
|
|
}
|
2018-02-04 23:59:42 +00:00
|
|
|
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
.close-dialog-button span {
|
|
|
|
padding: 0 10px 4px;
|
|
|
|
font-size: 32px;
|
|
|
|
}
|
|
|
|
}
|
2018-02-04 21:49:43 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
2018-02-05 03:15:35 +00:00
|
|
|
import A11yDialog from 'a11y-dialog'
|
2018-02-04 21:49:43 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
oncreate() {
|
2018-02-05 03:15:35 +00:00
|
|
|
let dialogElement = this.refs.node.parentElement
|
|
|
|
let a11yDialog = new A11yDialog(dialogElement)
|
2018-02-04 21:49:43 +00:00
|
|
|
this.observe('shown', shown => {
|
|
|
|
if (shown) {
|
2018-02-05 03:15:35 +00:00
|
|
|
a11yDialog.show()
|
|
|
|
a11yDialog.on('hide', () => {
|
|
|
|
console.log('destroying modal dialog')
|
|
|
|
a11yDialog.destroy()
|
|
|
|
this.destroy()
|
|
|
|
})
|
2018-02-04 21:49:43 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|