Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix: use modal for settings layout
Browse files
src/lib/components/Modal.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
| 3 |
import { cubicOut } from "svelte/easing";
|
| 4 |
-
import { fade } from "svelte/transition";
|
| 5 |
import Portal from "./Portal.svelte";
|
| 6 |
import { browser } from "$app/environment";
|
| 7 |
|
|
@@ -63,7 +63,11 @@
|
|
| 63 |
tabindex="-1"
|
| 64 |
bind:this={modalEl}
|
| 65 |
onkeydown={handleKeydown}
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
>
|
| 68 |
{@render children?.()}
|
| 69 |
</div>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
| 3 |
import { cubicOut } from "svelte/easing";
|
| 4 |
+
import { fade, fly } from "svelte/transition";
|
| 5 |
import Portal from "./Portal.svelte";
|
| 6 |
import { browser } from "$app/environment";
|
| 7 |
|
|
|
|
| 63 |
tabindex="-1"
|
| 64 |
bind:this={modalEl}
|
| 65 |
onkeydown={handleKeydown}
|
| 66 |
+
in:fly={{ y: 100 }}
|
| 67 |
+
class={[
|
| 68 |
+
"max-h-[90dvh] overflow-y-auto overflow-x-hidden rounded-2xl bg-white shadow-2xl outline-none sm:-mt-10",
|
| 69 |
+
width,
|
| 70 |
+
]}
|
| 71 |
>
|
| 72 |
{@render children?.()}
|
| 73 |
</div>
|
src/routes/settings/+layout.svelte
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { base } from "$app/paths";
|
| 3 |
-
import { clickOutside } from "$lib/actions/clickOutside";
|
| 4 |
import { afterNavigate, goto } from "$app/navigation";
|
| 5 |
import { useSettingsStore } from "$lib/stores/settings";
|
| 6 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
| 7 |
|
| 8 |
-
import
|
| 9 |
interface Props {
|
| 10 |
children?: import("svelte").Snippet;
|
| 11 |
}
|
|
@@ -23,29 +22,17 @@
|
|
| 23 |
const settings = useSettingsStore();
|
| 24 |
</script>
|
| 25 |
|
| 26 |
-
<
|
| 27 |
-
|
| 28 |
-
|
| 29 |
>
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
>
|
| 41 |
-
{@render children?.()}
|
| 42 |
-
{#if $settings.recentlySaved}
|
| 43 |
-
<div
|
| 44 |
-
class="absolute bottom-4 right-4 m-2 flex items-center gap-1.5 rounded-full border border-gray-300 bg-gray-200 px-3 py-1 text-black"
|
| 45 |
-
>
|
| 46 |
-
<CarbonCheckmark class="text-green-500" />
|
| 47 |
-
Saved
|
| 48 |
-
</div>
|
| 49 |
-
{/if}
|
| 50 |
-
</dialog>
|
| 51 |
-
</div>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { base } from "$app/paths";
|
|
|
|
| 3 |
import { afterNavigate, goto } from "$app/navigation";
|
| 4 |
import { useSettingsStore } from "$lib/stores/settings";
|
| 5 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
| 6 |
|
| 7 |
+
import Modal from "$lib/components/Modal.svelte";
|
| 8 |
interface Props {
|
| 9 |
children?: import("svelte").Snippet;
|
| 10 |
}
|
|
|
|
| 22 |
const settings = useSettingsStore();
|
| 23 |
</script>
|
| 24 |
|
| 25 |
+
<Modal
|
| 26 |
+
on:close={() => goto(previousPage)}
|
| 27 |
+
width="!h-[95dvh] !w-[90dvw] overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:!h-[85dvh] xl:!w-[1200px] 2xl:!h-[75dvh]"
|
| 28 |
>
|
| 29 |
+
{@render children?.()}
|
| 30 |
+
{#if $settings.recentlySaved}
|
| 31 |
+
<div
|
| 32 |
+
class="absolute bottom-4 right-4 m-2 flex items-center gap-1.5 rounded-full border border-gray-300 bg-gray-200 px-3 py-1 text-black"
|
| 33 |
+
>
|
| 34 |
+
<CarbonCheckmark class="text-green-500" />
|
| 35 |
+
Saved
|
| 36 |
+
</div>
|
| 37 |
+
{/if}
|
| 38 |
+
</Modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|