SPA & Text Inputs

This commit is contained in:
Neshura 2023-10-11 23:04:07 +02:00
commit 85f86a36e8
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
10 changed files with 80 additions and 21 deletions

18
src/lib/TextInput.svelte Normal file
View file

@ -0,0 +1,18 @@
<script lang="ts">
export let id: string;
export let value: string = "";
export let placeholder: string = "";
let width: number;
$: width = Math.max(value.length + 3, placeholder.length + 3);
</script>
<input {id} type="text" class="letterInput" style="--valuelen: {width}ch" bind:value={value} {placeholder}>
<style>
.letterInput {
width: var(--valuelen);
padding-left: 1ch;
}
</style>