~james/core

core/web/src/lib/components/settings/AccountFarewell.svelte -rw-r--r-- 1.6 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<script lang="ts">
	import { goto } from "$app/navigation";
	import { resolve } from "$app/paths";
	import type { Snippet } from "svelte";
	import Button from "#lib/components/ui/Button.svelte";
	import Logo from "#lib/components/ui/Logo.svelte";
	import CircleCheck from "$icon/circle-check";

	interface Props {
		title: string;
		testid?: string;
		children: Snippet;
	}

	let { title, testid, children }: Props = $props();

	const leave = () => goto(resolve("/"), { replaceState: true, invalidateAll: true });

	// portals to <body>: the layout isolates <main>, which would keep this under the topbar
	const toBody = (node: HTMLElement) => {
		document.body.appendChild(node);
		return () => node.remove();
	};
</script>

<div
	class="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-background-canvas px-4 pt-16 pb-8"
	role="dialog"
	aria-modal="true"
	aria-labelledby="account-farewell-heading"
	{@attach toBody}
>
	<main class="w-full max-w-wide">
		<div class="mb-8 flex place-content-center">
			<Logo wordmark class="h-10" />
		</div>

		<div
			class="mx-auto flex w-full max-w-compact flex-col items-center gap-4 rounded-md border border-border-default bg-background-default p-8 text-center"
		>
			<CircleCheck class="size-8 text-foreground-success" aria-hidden="true" />
			<h1
				id="account-farewell-heading"
				data-testid={testid}
				class="typography-heading-2 text-foreground-default"
			>
				{title}
			</h1>
			<p class="typography-paragraph-regular text-foreground-muted">
				{@render children()}
			</p>
			<Button onclick={leave}>Go to Tangled</Button>
		</div>
	</main>
</div>