From 609e15a7383f6b3fbb708fe8eaf900488c5dcb29 Mon Sep 17 00:00:00 2001 From: Gigi Date: Fri, 3 Oct 2025 00:27:31 +0200 Subject: [PATCH] feat(ui): truncate long bookmark text with expand/collapse chevron\n\n- Show first 210 chars by default\n- Toggle expansion with FontAwesome chevrons\n- Add minimal styles for the toggle --- src/components/BookmarkItem.tsx | 17 +++++++++++++++-- src/index.css | 12 ++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/components/BookmarkItem.tsx b/src/components/BookmarkItem.tsx index 5ecf51a7..4fad6d23 100644 --- a/src/components/BookmarkItem.tsx +++ b/src/components/BookmarkItem.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faBookmark, @@ -21,6 +21,7 @@ import { faEyeSlash, faThumbtack } from '@fortawesome/free-solid-svg-icons' +import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons' import { useEventModel } from 'applesauce-react/hooks' import { Models } from 'applesauce-core' import { IndividualBookmark } from '../types/bookmarks' @@ -35,6 +36,7 @@ interface BookmarkItemProps { } export const BookmarkItem: React.FC = ({ bookmark, index, onSelectUrl }) => { + const [expanded, setExpanded] = useState(false) // removed copy-to-clipboard buttons const short = (v: string) => `${v.slice(0, 8)}...${v.slice(-8)}` @@ -133,7 +135,18 @@ export const BookmarkItem: React.FC = ({ bookmark, index, onS {renderParsedContent(bookmark.parsedContent)} ) : bookmark.content && ( - + <> + + {bookmark.content.length > 210 && ( + + )} + )}
diff --git a/src/index.css b/src/index.css index ae64a1bf..39465771 100644 --- a/src/index.css +++ b/src/index.css @@ -501,6 +501,18 @@ body { word-break: break-word; } +.expand-toggle { + margin-top: 0.25rem; + background: transparent; + border: none; + color: #888; + cursor: pointer; +} + +.expand-toggle:hover { + color: #bbb; +} + .individual-bookmark .bookmark-meta { display: flex; gap: 1rem;