web/dialogs: moved backdrop to dialog holder, improved animation
This commit is contained in:
parent
8a080c55f6
commit
80300bf766
3 changed files with 36 additions and 47 deletions
|
@ -2,10 +2,10 @@
|
||||||
import SmallDialog from "./SmallDialog.svelte";
|
import SmallDialog from "./SmallDialog.svelte";
|
||||||
import dialogs from "$lib/dialogs";
|
import dialogs from "$lib/dialogs";
|
||||||
|
|
||||||
$: dialogVisible = $dialogs.length > 0;
|
$: backdropVisible = $dialogs.length > 0;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="dialog-holder" class:visible={dialogVisible}>
|
<div id="dialog-holder">
|
||||||
{#each $dialogs as dialog}
|
{#each $dialogs as dialog}
|
||||||
{#if dialog.type === "small"}
|
{#if dialog.type === "small"}
|
||||||
<SmallDialog
|
<SmallDialog
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
<div id="dialog-backdrop" class:visible={backdropVisible}></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -27,23 +28,37 @@
|
||||||
padding-top: env(safe-area-inset-bottom);
|
padding-top: env(safe-area-inset-bottom);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
z-index: 99;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 99;
|
|
||||||
|
|
||||||
visibility: hidden;
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog-backdrop {
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
z-index: -1;
|
||||||
|
|
||||||
|
background-color: var(--dialog-backdrop);
|
||||||
|
|
||||||
backdrop-filter: blur(7px);
|
backdrop-filter: blur(7px);
|
||||||
-webkit-backdrop-filter: blur(7px);
|
-webkit-backdrop-filter: blur(7px);
|
||||||
|
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dialog-holder.visible {
|
#dialog-backdrop.visible {
|
||||||
visibility: visible;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
:global([data-reduce-transparency="true"]) #dialog-holder {
|
:global([data-reduce-transparency="true"]) #dialog-backdrop {
|
||||||
backdrop-filter: none !important;
|
backdrop-filter: none !important;
|
||||||
-webkit-backdrop-filter: none !important;
|
-webkit-backdrop-filter: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="dialog-backdrop" aria-hidden="true" on:click={() => close()}></div>
|
<div id="dialog-backdrop-close" aria-hidden="true" on:click={() => close()}></div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -230,29 +230,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#dialog-backdrop {
|
#dialog-backdrop-close {
|
||||||
--backdrop-opacity: 0.4;
|
|
||||||
background-color: var(--popup-backdrop);
|
|
||||||
position: inherit;
|
position: inherit;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
opacity: 0;
|
|
||||||
animation: backdrop-in 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global([data-reduce-transparency="true"]) #dialog-backdrop {
|
|
||||||
--backdrop-opacity: 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.open #dialog-backdrop {
|
|
||||||
opacity: var(--backdrop-opacity);
|
|
||||||
animation: backdrop-in 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.closing #dialog-backdrop {
|
|
||||||
opacity: 0;
|
|
||||||
animation: backdrop-out 0.15s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes modal-in {
|
@keyframes modal-in {
|
||||||
|
@ -282,24 +264,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes backdrop-in {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: var(--backdrop-opacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes backdrop-out {
|
|
||||||
from {
|
|
||||||
opacity: var(--backdrop-opacity);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 535px) {
|
@media screen and (max-width: 535px) {
|
||||||
dialog {
|
dialog {
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
|
|
|
@ -78,9 +78,10 @@
|
||||||
--button-elevated-hover: #dadada;
|
--button-elevated-hover: #dadada;
|
||||||
|
|
||||||
--popup-bg: #f1f1f1;
|
--popup-bg: #f1f1f1;
|
||||||
--popup-backdrop: var(--primary);
|
|
||||||
--popup-stroke: rgba(0, 0, 0, 0.08);
|
--popup-stroke: rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
|
--dialog-backdrop: rgba(255, 255, 255, 0.3);
|
||||||
|
|
||||||
--sidebar-bg: #000000;
|
--sidebar-bg: #000000;
|
||||||
--sidebar-highlight: #ffffff;
|
--sidebar-highlight: #ffffff;
|
||||||
--sidebar-hover: rgba(255, 255, 255, 0.1);
|
--sidebar-hover: rgba(255, 255, 255, 0.1);
|
||||||
|
@ -144,9 +145,10 @@
|
||||||
--button-elevated-hover: #2f2f2f;
|
--button-elevated-hover: #2f2f2f;
|
||||||
|
|
||||||
--popup-bg: #191919;
|
--popup-bg: #191919;
|
||||||
--popup-backdrop: var(--primary);
|
|
||||||
--popup-stroke: rgba(255, 255, 255, 0.08);
|
--popup-stroke: rgba(255, 255, 255, 0.08);
|
||||||
|
|
||||||
|
--dialog-backdrop: rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
--sidebar-bg: #101010;
|
--sidebar-bg: #101010;
|
||||||
--sidebar-highlight: #f2f2f2;
|
--sidebar-highlight: #f2f2f2;
|
||||||
|
|
||||||
|
@ -165,6 +167,14 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global([data-theme="light"] [data-reduce-transparency="true"]) {
|
||||||
|
--dialog-backdrop: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global([data-theme="dark"] [data-reduce-transparency="true"]) {
|
||||||
|
--dialog-backdrop: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
:global(html),
|
:global(html),
|
||||||
:global(body) {
|
:global(body) {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
Loading…
Reference in a new issue