mirror of https://github.com/VERT-sh/VERT.git
feat: transition "convert n files" thing
This commit is contained in:
parent
5c132abb3d
commit
cda3825f6a
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
files: File[] | undefined;
|
files: File[] | undefined;
|
||||||
|
onupload?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|
@ -18,7 +19,7 @@
|
||||||
let fileInput = $state<HTMLInputElement>();
|
let fileInput = $state<HTMLInputElement>();
|
||||||
let dragOver = $state(false);
|
let dragOver = $state(false);
|
||||||
|
|
||||||
let { files = $bindable() }: Props = $props();
|
let { files = $bindable(), onupload }: Props = $props();
|
||||||
|
|
||||||
function upload() {
|
function upload() {
|
||||||
if (!fileInput) return;
|
if (!fileInput) return;
|
||||||
|
|
@ -62,6 +63,7 @@
|
||||||
if (!fileInput.files) return;
|
if (!fileInput.files) return;
|
||||||
if (!files) files = Array.from(fileInput.files);
|
if (!files) files = Array.from(fileInput.files);
|
||||||
else files.push(...Array.from(fileInput.files));
|
else files.push(...Array.from(fileInput.files));
|
||||||
|
onupload?.();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
import { quintOut } from "svelte/easing";
|
import { quintOut } from "svelte/easing";
|
||||||
import { files } from "$lib/store/index.svelte";
|
import { files } from "$lib/store/index.svelte";
|
||||||
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
||||||
|
import { fade, fly } from "svelte/transition";
|
||||||
let { children, data } = $props();
|
let { children, data } = $props();
|
||||||
|
|
||||||
let navWidth = $state(1);
|
let navWidth = $state(1);
|
||||||
|
|
@ -52,7 +53,7 @@
|
||||||
></div>
|
></div>
|
||||||
{#each Object.entries(links) as [name, link] (link)}
|
{#each Object.entries(links) as [name, link] (link)}
|
||||||
<button
|
<button
|
||||||
class="w-1/2 h-full flex items-center justify-center rounded-xl relative font-display"
|
class="w-1/2 h-full flex items-center justify-center rounded-xl relative font-display overflow-hidden"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
const keys = Object.keys(links);
|
const keys = Object.keys(links);
|
||||||
const currentIndex = keys.findIndex(
|
const currentIndex = keys.findIndex(
|
||||||
|
|
@ -66,9 +67,25 @@
|
||||||
goto(link);
|
goto(link);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="mix-blend-difference invert">
|
<div class="grid grid-cols-1 grid-rows-1">
|
||||||
{name}
|
{#key name}
|
||||||
</span>
|
<span
|
||||||
|
class="mix-blend-difference invert col-start-1 row-start-1"
|
||||||
|
in:fly={{
|
||||||
|
duration,
|
||||||
|
easing: quintOut,
|
||||||
|
y: -50,
|
||||||
|
}}
|
||||||
|
out:fly={{
|
||||||
|
duration,
|
||||||
|
easing: quintOut,
|
||||||
|
y: 50,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
{/key}
|
||||||
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
import Uploader from "$lib/components/functional/Uploader.svelte";
|
import Uploader from "$lib/components/functional/Uploader.svelte";
|
||||||
import { converters } from "$lib/converters";
|
import { converters } from "$lib/converters";
|
||||||
import { files } from "$lib/store/index.svelte";
|
import { files } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
$effect(() => {
|
|
||||||
$inspect(files);
|
|
||||||
});
|
|
||||||
|
|
||||||
const convertAllFiles = async () => {
|
const convertAllFiles = async () => {
|
||||||
const promises = files.files?.map(async (file, i) => {
|
const promises = files.files?.map(async (file, i) => {
|
||||||
let conversionType = files.conversionTypes[i];
|
let conversionType = files.conversionTypes[i];
|
||||||
|
|
@ -36,7 +33,10 @@
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Uploader bind:files={files.files} />
|
<Uploader
|
||||||
|
bind:files={files.files}
|
||||||
|
onupload={() => files.files.length > 0 && goto("/convert")}
|
||||||
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* for this page specifically */
|
/* for this page specifically */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue