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 && (
-
)}
diff --git a/src/components/feed/ComposeBox.tsx b/src/components/feed/ComposeBox.tsx
index 70a4660..daff435 100644
--- a/src/components/feed/ComposeBox.tsx
+++ b/src/components/feed/ComposeBox.tsx
@@ -1,6 +1,7 @@
import { useState, useRef, useEffect } from "react";
import { publishNote } from "../../lib/nostr";
import { uploadImage, uploadBytes } from "../../lib/upload";
+import { useAutoResize } from "../../hooks/useAutoResize";
import { useUserStore } from "../../stores/user";
import { useFeedStore } from "../../stores/feed";
import { shortenPubkey } from "../../lib/utils";
@@ -19,6 +20,7 @@ export function ComposeBox({ onPublished, onNoteInjected }: { onPublished?: () =
const [uploading, setUploading] = useState(false);
const [error, setError] = useState(null);
const [showEmoji, setShowEmoji] = useState(false);
+ const autoResize = useAutoResize(3, 12);
const textareaRef = useRef(null);
const { profile, npub } = useUserStore();
@@ -213,14 +215,14 @@ export function ComposeBox({ onPublished, onNoteInjected }: { onPublished?: () =
ref={textareaRef}
data-compose
value={text}
- onChange={(e) => setText(e.target.value)}
+ onChange={(e) => { setText(e.target.value); autoResize(e); }}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
onDrop={handleDrop}
onDragOver={handleDragOver}
placeholder="What's on your mind?"
rows={3}
- className="w-full bg-transparent text-text text-[13px] placeholder:text-text-dim resize-none focus:outline-none"
+ className="w-full bg-transparent text-text text-[13px] placeholder:text-text-dim resize-none focus:outline-none leading-relaxed"
/>
{error && (
diff --git a/src/components/feed/InlineReplyBox.tsx b/src/components/feed/InlineReplyBox.tsx
index ff509f9..315bffa 100644
--- a/src/components/feed/InlineReplyBox.tsx
+++ b/src/components/feed/InlineReplyBox.tsx
@@ -2,6 +2,7 @@ import { useState, useRef } from "react";
import { NDKEvent } from "@nostr-dev-kit/ndk";
import { publishReply } from "../../lib/nostr";
import { uploadImage, uploadBytes } from "../../lib/upload";
+import { useAutoResize } from "../../hooks/useAutoResize";
import { useReplyCount } from "../../hooks/useReplyCount";
import { EmojiPicker } from "../shared/EmojiPicker";
import { open } from "@tauri-apps/plugin-dialog";
@@ -21,6 +22,7 @@ export function InlineReplyBox({ event, name, rootEvent }: InlineReplyBoxProps)
const [showReplyEmoji, setShowReplyEmoji] = useState(false);
const [uploading, setUploading] = useState(false);
const [uploadError, setUploadError] = useState(null);
+ const autoResize = useAutoResize(2, 8);
const replyRef = useRef(null);
const [, adjustReplyCount] = useReplyCount(event.id);
@@ -138,12 +140,12 @@ export function InlineReplyBox({ event, name, rootEvent }: InlineReplyBoxProps)