export const adjustHeight = (textareaRef: HTMLTextAreaElement) => {
    const el = textareaRef;
    if (el) {
        el.style.height = "auto";
        el.style.height = "38px";

        // Clamp to max height for 6 lines
        const lineHeight = 18; // px, adjust if needed
        const maxHeight = lineHeight * 6;
        if (el.scrollHeight > maxHeight) {
            el.style.overflowY = "auto";
            el.style.height = `${maxHeight}px`;
        } else {
            el.style.overflowY = "hidden";
        }
    }
};