From 5b94162ce1935beabfaa7d58b028de9e50c6510e Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Wed, 25 Mar 2026 11:11:01 +0100 Subject: [PATCH] Auto-expanding textareas and proper article comment box Add useAutoResize hook that grows textareas to fit content up to a max. Applied to compose box, inline replies, thread replies, and article comments. Article comment input changed from single-line input to a multi-row textarea with Shift+Enter support. --- src/components/article/ArticleView.tsx | 31 +++++++++++++++----------- src/components/feed/ComposeBox.tsx | 6 +++-- src/components/feed/InlineReplyBox.tsx | 6 +++-- src/components/thread/ThreadView.tsx | 6 +++-- src/hooks/useAutoResize.ts | 24 ++++++++++++++++++++ 5 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 src/hooks/useAutoResize.ts diff --git a/src/components/article/ArticleView.tsx b/src/components/article/ArticleView.tsx index 7cc6e13..e1f38ec 100644 --- a/src/components/article/ArticleView.tsx +++ b/src/components/article/ArticleView.tsx @@ -1,6 +1,7 @@ import { useEffect, useState, useRef, useCallback } from "react"; import { NDKEvent } from "@nostr-dev-kit/ndk"; import { renderMarkdown } from "../../lib/markdown"; +import { useAutoResize } from "../../hooks/useAutoResize"; import { useUIStore } from "../../stores/ui"; import { useUserStore } from "../../stores/user"; import { useBookmarkStore } from "../../stores/bookmark"; @@ -77,6 +78,7 @@ export function ArticleView() { const [reposted, setReposted] = useState(false); const [showComment, setShowComment] = useState(false); const [commentText, setCommentText] = useState(""); + const autoResize = useAutoResize(3, 10); const { isBookmarked, addBookmark, removeBookmark } = useBookmarkStore(); const naddr = pendingArticleNaddr ?? ""; @@ -291,23 +293,26 @@ export function ArticleView() { {/* Comment box */} {showComment && event && ( -
- +