refac: banners
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
export let placeholder = '';
|
||||
export let rows = 1;
|
||||
export let minSize = null;
|
||||
export let maxSize = null;
|
||||
export let required = false;
|
||||
export let className =
|
||||
'w-full rounded-lg px-3.5 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden h-full';
|
||||
@@ -30,9 +31,16 @@
|
||||
const resize = () => {
|
||||
if (textareaElement) {
|
||||
textareaElement.style.height = '';
|
||||
textareaElement.style.height = minSize
|
||||
? `${Math.max(textareaElement.scrollHeight, minSize)}px`
|
||||
: `${textareaElement.scrollHeight}px`;
|
||||
|
||||
let height = textareaElement.scrollHeight;
|
||||
if (maxSize && height > maxSize) {
|
||||
height = maxSize;
|
||||
}
|
||||
if (minSize && height < minSize) {
|
||||
height = minSize;
|
||||
}
|
||||
|
||||
textareaElement.style.height = `${height}px`;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user