diff --git a/src/renderer/features/artists/components/album-artist-detail-content.module.css b/src/renderer/features/artists/components/album-artist-detail-content.module.css index 1c509b051..9dbe9d576 100644 --- a/src/renderer/features/artists/components/album-artist-detail-content.module.css +++ b/src/renderer/features/artists/components/album-artist-detail-content.module.css @@ -48,3 +48,19 @@ width: 100%; min-width: 0; } + +.album-grid { + display: flex; + flex-wrap: wrap; + gap: var(--theme-spacing-md); + width: 100%; +} + +.album-grid-item { + flex: 1 1 + calc((100% - (var(--items-per-row) - 1) * var(--theme-spacing-md)) / var(--items-per-row)); + min-width: 0; + max-width: calc( + (100% - (var(--items-per-row) - 1) * var(--theme-spacing-md)) / var(--items-per-row) + ); +} 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 85b7fa320..e623d405d 100644 --- a/src/renderer/features/artists/components/album-artist-detail-content.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-content.tsx @@ -696,22 +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 getItemsPerRow = (cq: ReturnType) => { + // Match grid carousel breakpoints: is3xl: 8, is2xl: 7, isXl: 6, isLg: 5, isMd: 4, isSm: 3, default: 2 + if (cq.is3xl) return 8; + if (cq.is2xl) return 7; + if (cq.isXl) return 6; + if (cq.isLg) return 5; + if (cq.isMd) return 4; + if (cq.isSm) return 3; + if (cq.isXs) return 2; + return 2; }; const AlbumSection = ({ albums, controls, cq, releaseType, rows, title }: AlbumSectionProps) => { const { t } = useTranslation(); - const span = getSpan(cq); + const itemsPerRow = getItemsPerRow(cq); const albumCount = albums.length; const [showAll, setShowAll] = useState(false); const player = usePlayer(); @@ -809,31 +809,38 @@ const AlbumSection = ({ albums, controls, cq, releaseType, rows, title }: AlbumS )} - +
{displayedAlbums.map((album) => ( - - - - - + + + ))} - +
{hasMoreAlbums && !showAll && (