From 710fc16f620cfd014c753c8357a23b6a4f5a230d Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 27 Dec 2025 16:22:02 -0800 Subject: [PATCH] adjust artist album grid span --- .../album-artist-detail-content.tsx | 17 ++++++- src/renderer/hooks/use-container-query.ts | 44 +++++++++++++++---- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/renderer/features/artists/components/album-artist-detail-content.tsx b/src/renderer/features/artists/components/album-artist-detail-content.tsx index 3fb89b0f7..85b7fa320 100644 --- a/src/renderer/features/artists/components/album-artist-detail-content.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-content.tsx @@ -696,9 +696,22 @@ interface AlbumSectionProps { const MAX_SECTION_CARDS = 20; +const getSpan = (cq: ReturnType) => { + if (cq.is4xl) return 6; + if (cq.is3xl) return 7; + if (cq.is2xl) return 8; + if (cq.isXl) return 9; + if (cq.isLg) return 12; + if (cq.isMd) return 12; + if (cq.isSm) return 16; + if (cq.isXs) return 24; + return 24; +}; + const AlbumSection = ({ albums, controls, cq, releaseType, rows, title }: AlbumSectionProps) => { const { t } = useTranslation(); - const span = cq.isXl ? 3 : cq.isLg ? 4 : cq.isMd ? 6 : cq.isSm ? 8 : cq.isXs ? 12 : 12; + + const span = getSpan(cq); const albumCount = albums.length; const [showAll, setShowAll] = useState(false); const player = usePlayer(); @@ -796,7 +809,7 @@ const AlbumSection = ({ albums, controls, cq, releaseType, rows, title }: AlbumS )} - + {displayedAlbums.map((album) => ( { - const { '2xl': xxl, '3xl': xxxl, lg, md, sm, xl, xs } = props || {}; + const { + '2xl': xxl, + '3xl': xxxl, + '4xl': xxxxl, + '5xl': xxxxxl, + lg, + md, + sm, + xl, + xs, + } = props || {}; const { height, ref, width } = useElementSize(); const isXs = width >= (xs || 360); - const isSm = width >= (sm || 600); - const isMd = width >= (md || 768); - const isLg = width >= (lg || 960); - const isXl = width >= (xl || 1200); - const is2xl = width >= (xxl || 1440); - const is3xl = width >= (xxxl || 1920); + const isSm = width >= (sm || 480); + const isMd = width >= (md || 600); + const isLg = width >= (lg || 768); + const isXl = width >= (xl || 960); + const is2xl = width >= (xxl || 1152); + const is3xl = width >= (xxxl || 1280); + const is4xl = width >= (xxxxl || 1440); + const is5xl = width >= (xxxxxl || 1600); const isCalculated = width !== 0; - return { height, is2xl, is3xl, isCalculated, isLg, isMd, isSm, isXl, isXs, ref, width }; + return { + height, + is2xl, + is3xl, + is4xl, + is5xl, + isCalculated, + isLg, + isMd, + isSm, + isXl, + isXs, + ref, + width, + }; };