diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..6c054c5 --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,28 @@ + + +
+

+ Well, that's an error... +

+

+ {status}: "{message}" +

+

+ Sorry about that. Click the suyu logo to go home. +

+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9c48563..4a5e4b4 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -6,6 +6,11 @@ import { browser } from "$app/environment"; import { writable } from "svelte/store"; import { setContext } from "svelte"; + import type { TransitionConfig } from "svelte/transition"; + import type { PageData } from "./$types"; + import { bounceOut } from "svelte/easing"; + + export let data: PageData; // TODO: refactor interface NavItem { @@ -39,6 +44,87 @@ const transition = "linear(0,0.006,0.025 2.8%,0.101 6.1%,0.539 18.9%,0.721 25.3%,0.849 31.5%,0.937 38.1%,0.968 41.8%,0.991 45.7%,1.006 50.1%,1.015 55%,1.017 63.9%,1.001)"; + function transitionIn(node: HTMLElement, { duration = 360 }: TransitionConfig) { + const UA = navigator.userAgent; + const ff = UA.indexOf("Firefox") > -1; + if (!dropdownCloseFinished) { + node.animate( + [ + { + top: "160px", + opacity: "0", + filter: ff ? "" : "blur(20px)", + }, + { + top: "0", + opacity: "1", + filter: ff ? "" : "blur(0px)", + }, + ], + { + easing: transition, + duration, + }, + ); + + return { + duration: 0, + }; + } + // FUCK YOUR DEFAULT SYSTEM, SVELTEKIT!!! + node.animate( + [ + { + top: "-240px", + opacity: "0", + filter: ff ? "" : "blur(20px)", + }, + { + top: "0", + opacity: "1", + filter: ff ? "" : "blur(0px)", + }, + ], + { + easing: transition, + duration, + }, + ); + return { + duration, + }; + } + + function transitionOut(node: HTMLElement, { duration = 360 }: TransitionConfig) { + if (!dropdownCloseFinished) + return { + duration: 0, + }; + const UA = navigator.userAgent; + const ff = UA.indexOf("Firefox") > -1; + node.animate( + [ + { + top: "0", + opacity: "1", + filter: ff ? "" : "blur(0px)", + }, + { + top: "240px", + opacity: "0", + filter: ff ? "" : "blur(80px)", + }, + ], + { + easing: transition, + duration, + }, + ); + return { + duration, + }; + } + let dropdownOpen = false; let dropdownCloseFinished = true; let dropdownOpenFinished = false; @@ -108,7 +194,7 @@ } } - function openDropdown() { + function toggleDropdown() { dropdownOpen = !dropdownOpen; } @@ -153,7 +239,12 @@ : "mx-auto flex h-[120px] w-full max-w-[1300px] flex-row items-center justify-between px-8"} >
- + { + if (dropdownOpen && window.innerWidth < 625) toggleDropdown(); + }} + >
@@ -182,15 +273,15 @@ > - {$token ? "Account" : "Sign up"} + > -->