mirror of https://github.com/VERT-sh/VERT.git
Remove all server code, readd fly transition
only add fly transition for desktop
This commit is contained in:
parent
dbff210343
commit
50d93c0273
|
@ -1,3 +1,4 @@
|
||||||
|
import { isMobile } from "$lib/store/index.svelte";
|
||||||
import type { AnimationConfig, FlipParams } from "svelte/animate";
|
import type { AnimationConfig, FlipParams } from "svelte/animate";
|
||||||
import { cubicOut } from "svelte/easing";
|
import { cubicOut } from "svelte/easing";
|
||||||
import {
|
import {
|
||||||
|
@ -19,7 +20,7 @@ export function fade(node: HTMLElement, options: FadeParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fly(node: HTMLElement, options: FlyParams) {
|
export function fly(node: HTMLElement, options: FlyParams) {
|
||||||
if (localStorage.getItem("motion") === "false") return {};
|
if (localStorage.getItem("motion") === "false" || isMobile) return {};
|
||||||
const animation = svelteFly(node, options);
|
const animation = svelteFly(node, options);
|
||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,3 +194,5 @@ export function setMotion(motion: boolean) {
|
||||||
export const files = new Files();
|
export const files = new Files();
|
||||||
export const showGradient = writable(true);
|
export const showGradient = writable(true);
|
||||||
export const gradientColor = writable("");
|
export const gradientColor = writable("");
|
||||||
|
|
||||||
|
export const isMobile = writable(false);
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
export const load = ({ url, request }) => {
|
|
||||||
const { pathname } = url;
|
|
||||||
const ua = request.headers.get("user-agent");
|
|
||||||
const isMobile = /mobile/i.test(ua || "");
|
|
||||||
const isFirefox = /firefox/i.test(ua || "");
|
|
||||||
return {
|
|
||||||
pathname,
|
|
||||||
isMobile,
|
|
||||||
isFirefox,
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,17 +1,19 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { page } from '$app/state';
|
||||||
import { beforeNavigate, goto } from "$app/navigation";
|
import { beforeNavigate, goto } from "$app/navigation";
|
||||||
import { PUB_HOSTNAME, PUB_PLAUSIBLE_URL } from "$env/static/public";
|
import { PUB_HOSTNAME, PUB_PLAUSIBLE_URL } from "$env/static/public";
|
||||||
import { duration } from "$lib/animation";
|
import { duration, fly } from "$lib/animation";
|
||||||
import VertVBig from "$lib/assets/vert-bg.svg?component";
|
import VertVBig from "$lib/assets/vert-bg.svg?component";
|
||||||
import featuredImage from "$lib/assets/VERT_Feature.webp";
|
import featuredImage from "$lib/assets/VERT_Feature.webp";
|
||||||
import Navbar from "$lib/components/functional/Navbar.svelte";
|
import Navbar from "$lib/components/functional/Navbar.svelte";
|
||||||
import Footer from "$lib/components/visual/Footer.svelte";
|
import Footer from "$lib/components/visual/Footer.svelte";
|
||||||
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
||||||
|
|
||||||
import { fade, fly } from "$lib/animation";
|
import { fade } from "$lib/animation";
|
||||||
import {
|
import {
|
||||||
files,
|
files,
|
||||||
gradientColor,
|
gradientColor,
|
||||||
|
isMobile,
|
||||||
showGradient,
|
showGradient,
|
||||||
} from "$lib/store/index.svelte";
|
} from "$lib/store/index.svelte";
|
||||||
import {
|
import {
|
||||||
|
@ -84,6 +86,11 @@
|
||||||
|
|
||||||
navbar?.addEventListener("mouseenter", mouseEnter);
|
navbar?.addEventListener("mouseenter", mouseEnter);
|
||||||
navbar?.addEventListener("mouseleave", mouseLeave);
|
navbar?.addEventListener("mouseleave", mouseLeave);
|
||||||
|
|
||||||
|
isMobile.set(window.innerWidth <= 768);
|
||||||
|
document.addEventListener("resize", () => {
|
||||||
|
isMobile.set(window.innerWidth <= 768);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let goingLeft = $state(false);
|
let goingLeft = $state(false);
|
||||||
|
@ -142,13 +149,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-rows-1 grid-cols-1 h-full flex-grow">
|
<div class="grid grid-rows-1 grid-cols-1 h-full flex-grow">
|
||||||
{#key data.pathname}
|
{#key page.url.pathname}
|
||||||
<div
|
|
||||||
class="row-start-1 col-start-1"
|
|
||||||
transition:fade={{ duration, easing: quintOut }}
|
|
||||||
>
|
|
||||||
<!--
|
|
||||||
FIXME fly animations cause issues for some reason (page height extending during transition, causing scrollbar to disappear briefly (on mobile) & ability to scroll)
|
|
||||||
<div
|
<div
|
||||||
class="row-start-1 col-start-1"
|
class="row-start-1 col-start-1"
|
||||||
in:fly={{
|
in:fly={{
|
||||||
|
@ -162,6 +163,7 @@
|
||||||
duration,
|
duration,
|
||||||
easing: quintOut,
|
easing: quintOut,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col h-full pb-36 md:pb-0"
|
class="flex flex-col h-full pb-36 md:pb-0"
|
||||||
in:fade={{
|
in:fade={{
|
||||||
|
@ -175,9 +177,9 @@
|
||||||
delay: 200,
|
delay: 200,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
>-->
|
<div class="flex flex-col h-full pb-36 md:pb-0">
|
||||||
<div class="flex flex-col h-full pb-36 md:pb-0">
|
{@render children()}
|
||||||
{@render children()}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/key}
|
{/key}
|
||||||
|
@ -209,7 +211,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Gradients placed here to prevent it overlapping in transitions -->
|
<!-- Gradients placed here to prevent it overlapping in transitions -->
|
||||||
{#if data.pathname === "/"}
|
{#if page.url.pathname === "/"}
|
||||||
<div
|
<div
|
||||||
class="fixed -z-30 top-0 left-0 w-screen h-screen flex items-center justify-center overflow-hidden"
|
class="fixed -z-30 top-0 left-0 w-screen h-screen flex items-center justify-center overflow-hidden"
|
||||||
>
|
>
|
||||||
|
@ -220,19 +222,19 @@
|
||||||
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
||||||
style="background: var(--bg-gradient);"
|
style="background: var(--bg-gradient);"
|
||||||
></div>
|
></div>
|
||||||
{:else if data.pathname === "/convert" && $showGradient}
|
{:else if page.url.pathname === "/convert" && $showGradient}
|
||||||
<div
|
<div
|
||||||
id="gradient-bg"
|
id="gradient-bg"
|
||||||
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
||||||
style="background: var(--bg-gradient-{$gradientColor || 'pink'});"
|
style="background: var(--bg-gradient-{$gradientColor || 'pink'});"
|
||||||
></div>
|
></div>
|
||||||
{:else if data.pathname === "/settings"}
|
{:else if page.url.pathname === "/settings"}
|
||||||
<div
|
<div
|
||||||
id="gradient-bg"
|
id="gradient-bg"
|
||||||
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
||||||
style="background: var(--bg-gradient-blue);"
|
style="background: var(--bg-gradient-blue);"
|
||||||
></div>
|
></div>
|
||||||
{:else if data.pathname === "/about"}
|
{:else if page.url.pathname === "/about"}
|
||||||
<div
|
<div
|
||||||
id="gradient-bg"
|
id="gradient-bg"
|
||||||
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
||||||
|
|
Loading…
Reference in New Issue