refac: styling

This commit is contained in:
Timothy J. Baek
2024-10-20 19:04:30 -07:00
parent 2f5c65bd1f
commit 438b277be0
3 changed files with 17 additions and 14 deletions

View File

@@ -4,6 +4,9 @@
export let value = '';
export let placeholder = '';
export let rows = 1;
export let required = false;
export let className =
'w-full rounded-lg px-3 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none resize-none h-full';
@@ -12,7 +15,7 @@
onMount(async () => {
await tick();
if (textareaElement) {
setInterval(adjustHeight, 0);
setTimeout(adjustHeight, 0);
}
});
@@ -28,10 +31,8 @@
bind:this={textareaElement}
bind:value
{placeholder}
on:input={adjustHeight}
class={className}
on:input={(e) => {
e.target.style.height = '';
e.target.style.height = `${e.target.scrollHeight}px`;
}}
rows="1"
{rows}
{required}
/>