mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
770 B
46 lines
770 B
6 years ago
|
<script>
|
||
|
import { createEventDispatcher } from 'svelte';
|
||
|
|
||
|
const dispatch = createEventDispatcher();
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
.modal-background {
|
||
|
position: fixed;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
background: rgba(0,0,0,0.3);
|
||
|
}
|
||
|
|
||
|
.modal {
|
||
|
position: absolute;
|
||
|
left: 50%;
|
||
|
top: 50%;
|
||
|
width: calc(100vw - 4em);
|
||
|
max-width: 32em;
|
||
|
max-height: calc(100vh - 4em);
|
||
|
overflow: auto;
|
||
|
transform: translate(-50%,-50%);
|
||
|
padding: 1em;
|
||
|
border-radius: 0.2em;
|
||
|
background: white;
|
||
|
}
|
||
|
|
||
|
button {
|
||
|
display: block;
|
||
|
}
|
||
|
</style>
|
||
6 years ago
|
|
||
|
<div class='modal-background' on:click='{() => dispatch("close")}'></div>
|
||
|
|
||
|
<div class='modal'>
|
||
|
<slot name='header'></slot>
|
||
|
<hr>
|
||
|
<slot></slot>
|
||
|
<hr>
|
||
|
|
||
|
<button on:click='{() => dispatch("close")}'>close modal</button>
|
||
|
</div>
|