From cefd88417213ba6fd8bdc8d537001bb261977250 Mon Sep 17 00:00:00 2001 From: "Andrey K. Choi" Date: Sun, 9 Nov 2025 12:08:35 +0900 Subject: [PATCH] Fix: Implement proper link scrolling in groups using ExpandableGroup component - Replace all hardcoded group.links.slice(0, 5) with ExpandableGroup component - Updated renderGridLayout, renderCardsLayout, renderCompactLayout, renderSidebarLayout - Fixed icon display in ExpandableGroup component - Improved styling for button-style links - All group layouts now support expandable link lists with 'Show X more links' functionality --- .../src/app/[username]/page.tsx | 128 ++++++------------ .../app/components/ExpandableGroup.module.css | 28 ++-- .../src/app/components/ExpandableGroup.tsx | 6 +- 3 files changed, 58 insertions(+), 104 deletions(-) diff --git a/frontend/linktree-frontend/src/app/[username]/page.tsx b/frontend/linktree-frontend/src/app/[username]/page.tsx index d540f67..bce0329 100644 --- a/frontend/linktree-frontend/src/app/[username]/page.tsx +++ b/frontend/linktree-frontend/src/app/[username]/page.tsx @@ -303,33 +303,19 @@ export default function UserPage({

)}
- {group.links.slice(0, 5).map((link) => ( - - {designSettings.show_link_icons && link.icon_url && ( - {link.title} - )} - {link.title} - - ))} - {group.links.length > 5 && ( - +{group.links.length - 5} еще... - )} + ({ + id: link.id, + title: link.title, + url: link.url, + description: link.description, + image: designSettings.show_link_icons ? link.icon_url : undefined + }))} + layout="grid" + initialShowCount={5} + className="" + linkClassName="btn btn-outline-primary btn-sm d-flex align-items-center justify-content-start" + />
@@ -476,35 +462,19 @@ export default function UserPage({ )} -
- {group.links.map((link) => ( -
- - {designSettings.show_link_icons && link.icon && ( - - )} - - {link.title} - - -
- ))} -
+ ({ + id: link.id, + title: link.title, + url: link.url, + description: link.description, + image: designSettings.show_link_icons ? link.icon_url : undefined + }))} + layout="cards" + initialShowCount={10} + className="row" + linkClassName="col-auto mb-1" + /> ))} @@ -572,39 +542,19 @@ export default function UserPage({ backgroundPosition: 'center' }} > -
- {group.links.map((link) => ( -
- -
- {designSettings.show_link_icons && link.icon && ( - - )} -
-
- {link.title} -
- {link.description && ( - {link.description} - )} -
-
- -
- ))} -
+ ({ + id: link.id, + title: link.title, + url: link.url, + description: link.description, + image: designSettings.show_link_icons ? link.icon_url : undefined + }))} + layout="cards" + initialShowCount={6} + className="row" + linkClassName="col-12 col-md-6 col-lg-4 mb-3" + /> ))} diff --git a/frontend/linktree-frontend/src/app/components/ExpandableGroup.module.css b/frontend/linktree-frontend/src/app/components/ExpandableGroup.module.css index 55f9b1f..f242750 100644 --- a/frontend/linktree-frontend/src/app/components/ExpandableGroup.module.css +++ b/frontend/linktree-frontend/src/app/components/ExpandableGroup.module.css @@ -41,6 +41,10 @@ position: relative; overflow: hidden; border-radius: 10px; + border: none; + background: white; + width: 100%; + text-align: left; &:hover { text-decoration: none; @@ -53,20 +57,19 @@ .linkInner { display: flex; align-items: center; - padding: 1rem; - background: white; + padding: 0.75rem; border-radius: 10px; - border: 1px solid #e9ecef; position: relative; z-index: 1; + width: 100%; } .linkIcon { - width: 40px; - height: 40px; + width: 20px; + height: 20px; object-fit: cover; - border-radius: 8px; - margin-right: 1rem; + border-radius: 4px; + margin-right: 0.75rem; flex-shrink: 0; } @@ -76,17 +79,18 @@ } .linkTitle { - margin: 0 0 0.25rem 0; - font-size: 1rem; - font-weight: 600; + margin: 0; + font-size: 0.875rem; + font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + color: inherit; } .linkDescription { - margin: 0; - font-size: 0.875rem; + margin: 0.25rem 0 0 0; + font-size: 0.75rem; color: #6c757d; white-space: nowrap; overflow: hidden; diff --git a/frontend/linktree-frontend/src/app/components/ExpandableGroup.tsx b/frontend/linktree-frontend/src/app/components/ExpandableGroup.tsx index c7ff9e3..79681cc 100644 --- a/frontend/linktree-frontend/src/app/components/ExpandableGroup.tsx +++ b/frontend/linktree-frontend/src/app/components/ExpandableGroup.tsx @@ -117,7 +117,7 @@ function LinkItem({ link, layout, className = '', overlayColor, overlayOpacity } href={link.url} target="_blank" rel="noopener noreferrer" - className={`${styles.linkContent} link-item ${layout}-link`} + className={`${styles.linkContent} link-item ${layout}-link btn btn-outline-primary btn-sm d-flex align-items-center justify-content-start`} >
{link.image && ( @@ -128,9 +128,9 @@ function LinkItem({ link, layout, className = '', overlayColor, overlayOpacity } /> )}
-
{link.title}
+ {link.title} {link.description && ( -

{link.description}

+ {link.description} )}