feat: start implement panels rendering, remove unused files
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { SlideDirection } from "$lib/types/utils";
|
||||
import type { SlideDirection } from "$lib/util-types";
|
||||
import { imageConfigState } from "$states/image.svelte";
|
||||
import { Image, Layer, Stage, Text } from "svelte-konva";
|
||||
import { fly } from "svelte/transition";
|
||||
|
||||
interface Props {
|
||||
@@ -10,8 +12,29 @@
|
||||
let { text, direction }: Props = $props();
|
||||
|
||||
let xDirection = $derived(direction == "next" ? 320 : -320);
|
||||
|
||||
let image: HTMLImageElement | undefined = imageConfigState.image;
|
||||
</script>
|
||||
|
||||
<div in:fly={{ x: xDirection, duration: 300 }} out:fly={{ x: -xDirection, duration: 300 }}>
|
||||
{text}
|
||||
<div class="konva-wrapper" in:fly={{ x: xDirection, duration: 300 }} out:fly={{ x: -xDirection, duration: 300 }}>
|
||||
<Stage width={320} height={100}>
|
||||
<Layer>
|
||||
<Image {image}></Image>
|
||||
{$inspect(image)}
|
||||
<Text {text} x={10} y={10} fontsize="32" fill="white"></Text>
|
||||
</Layer>
|
||||
</Stage>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.konva-wrapper {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Button from "$components/ui/Button.svelte";
|
||||
import IconArrowLeft from "$components/ui/Icons/IconArrowLeft.svelte";
|
||||
import IconArrowRight from "$components/ui/Icons/IconArrowRight.svelte";
|
||||
import type { SlideDirection } from "$lib/types/utils";
|
||||
import type { SlideDirection } from "$lib/util-types";
|
||||
|
||||
interface Props {
|
||||
current: number;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import Button from "$components/ui/Button.svelte";
|
||||
import IconDownload from "$components/ui/Icons/IconDownload.svelte";
|
||||
import IconEmpty from "$components/ui/Icons/IconEmpty.svelte";
|
||||
import type { SlideDirection } from "$lib/types/utils";
|
||||
import type { SlideDirection } from "$lib/util-types";
|
||||
import { textsState } from "$states/texts.svelte";
|
||||
import Preview from "./Preview.svelte";
|
||||
import PreviewControls from "./PreviewControls.svelte";
|
||||
@@ -14,7 +14,13 @@
|
||||
|
||||
$effect(() => {
|
||||
$inspect(current, textsState.texts);
|
||||
if (current > textsState.texts.length - 1) current = textsState.texts.length - 1;
|
||||
if (textsState.texts.length === 0) {
|
||||
current = 0;
|
||||
} else {
|
||||
if (current > textsState.texts.length - 1) {
|
||||
current = textsState.texts.length - 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -30,9 +36,9 @@
|
||||
<div class="panel-viewer">
|
||||
<div class="panel-display">
|
||||
{#if textsState.texts.length}
|
||||
<!-- {@const text = } -->
|
||||
{#key current}
|
||||
<Preview text={textsState.texts[current].text} {direction} />
|
||||
{@const text = textsState?.texts[current]?.text}
|
||||
<Preview {text} {direction} />
|
||||
{/key}
|
||||
{:else}
|
||||
<div class="empty-state">
|
||||
@@ -64,6 +70,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 150px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.panel-actions {
|
||||
|
||||
Reference in New Issue
Block a user