mirror of
https://github.com/KevinMidboe/planetposen-frontend.git
synced 2025-10-29 13:10:12 +00:00
Resolved all eslint issues
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { fade, fly, slide } from 'svelte/transition';
|
||||
import type IOrderValidationError from '$lib/interfaces/IOrderValidationError';
|
||||
import { fly, slide } from 'svelte/transition';
|
||||
|
||||
export let errors: string[] = [];
|
||||
let currentCard = 0;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import ProductTile from './ProductTile.svelte';
|
||||
import Button from './Button.svelte';
|
||||
// import Button from './Button.svelte';
|
||||
import type { IProduct } from '$lib/interfaces/IProduct';
|
||||
import LinkArrow from './LinkArrow.svelte';
|
||||
|
||||
export let products: IProduct[];
|
||||
export let title: string;
|
||||
export let textColor: string = 'black';
|
||||
export let backgroundColor: string = 'white';
|
||||
export let textColor = 'black';
|
||||
export let backgroundColor = 'white';
|
||||
|
||||
let galleryStyles = `background-color: ${backgroundColor}; color: ${textColor}`;
|
||||
</script>
|
||||
|
||||
@@ -80,7 +80,7 @@ color: ${product?.primary_color === '#231B1D' ? '#f3efeb' : '#37301e'}`;
|
||||
if (entries[0]?.isIntersecting) {
|
||||
const target = entries[0]?.target as HTMLElement;
|
||||
const targetIndex = Number(target?.dataset?.index);
|
||||
if (targetIndex === NaN) return;
|
||||
if (isNaN(targetIndex)) return;
|
||||
|
||||
selected = targetIndex;
|
||||
updateHeight();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let dragOver: boolean = false;
|
||||
let dragOver = false;
|
||||
let fileInput: HTMLInputElement;
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
@@ -23,7 +23,7 @@
|
||||
await uploadImage(file);
|
||||
}
|
||||
|
||||
setTimeout(() => (fileInput.value = ''), 3000);
|
||||
setTimeout(() => resetUploadInput, 3000);
|
||||
}
|
||||
|
||||
function resetUploadInput() {
|
||||
@@ -80,20 +80,21 @@
|
||||
// uploadImage(file)
|
||||
}
|
||||
|
||||
function onFileDrop(event: Event) {
|
||||
const { files } = event?.dataTransfer;
|
||||
function onFileDrop(event: DragEvent) {
|
||||
const files: FileList | undefined = event?.dataTransfer?.files;
|
||||
if (files) {
|
||||
fileInput.files = files;
|
||||
}
|
||||
}
|
||||
|
||||
$: hasFiles = fileInput?.files?.length > 0 || false;
|
||||
$: hasFiles = (fileInput?.files && fileInput?.files?.length > 0) || false;
|
||||
</script>
|
||||
|
||||
<div
|
||||
id="drop_zone"
|
||||
class="{dragOver ? 'highlighted' : ''}"
|
||||
on:click="{() => fileInput.click()}"
|
||||
on:keypress="{(e) => e.code === 'Enter' && fileInput.click()}"
|
||||
on:drop|preventDefault="{onFileDrop}"
|
||||
on:dragover|preventDefault="{() => (dragOver = true)}"
|
||||
on:dragenter|preventDefault="{() => (dragOver = true)}"
|
||||
@@ -118,8 +119,11 @@
|
||||
<span>Files found to upload:</span>
|
||||
|
||||
<div class="thumbnails">
|
||||
{#each fileInput.files || [] as file}
|
||||
<img src="{window.URL.createObjectURL(file)}" />
|
||||
{#each fileInput.files || [] as file, index}
|
||||
<img
|
||||
src="{window.URL.createObjectURL(file)}"
|
||||
alt="{`Upload asset thumbnail number ${index + 1}`}"
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user