Tags Input + Improved Date Input

This commit is contained in:
Neshura 2023-10-24 11:37:27 +02:00
parent 85f86a36e8
commit 2b5a19fdd6
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
3 changed files with 79 additions and 10 deletions
src/lib/ListTextInput

View file

@ -0,0 +1,26 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
export let id: number;
export let value: string;
let width: number;
$: width = Math.max(value.length + 3, 6);
const handleClick = () => {
dispatch('deleted', {
tagId: id,
});
}
</script>
<input id="tag-{id}" type="text" class="letterInput" style="--valuelen: {width}ch" bind:value={value}>
<button on:click={handleClick}>X</button>
<style>
.letterInput {
width: var(--valuelen);
padding-left: 1ch;
}
</style>